diff --git a/src/memory.c b/src/memory.c
index af93fa6f7b00a2af6d1a9d5bacd6d0a028e3ee00..4abb35a167304b672ea36876c0929b28dcd262f4 100644 (file)
--- a/src/memory.c
+++ b/src/memory.c
-/*
- Copyright (C) Prikol Software 1996-1997
- Copyright (C) Aleksey Volynskov 1996-1997
-
- This file is part of the Doom2D:Rembo project.
-
- Doom2D:Rembo is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2 as
- published by the Free Software Foundation.
-
- Doom2D:Rembo is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/> or
- write to the Free Software Foundation, Inc.,
- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
+/* Copyright (C) 1996-1997 Aleksey Volynskov
+ * Copyright (C) 2011 Rambo
+ * Copyright (C) 2020 SovietPony
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3 of the License ONLY.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include "glob.h"
#include <stdio.h>
#include "files.h"
#include "memory.h"
-dword dpmi_memavl(void);
-
-extern int d_start,d_end;
-
-extern mwad_t wad[];
-
-static byte m_active=FALSE;
-
+static byte m_active;
static void *resp[MAX_WAD];
static short resl[MAX_WAD];
-void M_startup(void) {
+void M_startup (void) {
if(m_active) return;
logo("M_startup: настройка памяти\n");
memset(resp,0,sizeof(resp));
m_active=TRUE;
}
-void M_shutdown(void) {
-
+void M_shutdown (void) {
if(!m_active) return;
m_active=FALSE;
}
-static void allocres(int h) {
+static void allocres (int h) {
int *p,s;
if(h>d_start && h<d_end) s=1; else s=0;
}else F_loadres(h,p,0,wad[h].l);
}
-void *M_lock(int h) {
+void *M_lock (int h) {
if(h==-1 || h==0xFFFF) return NULL;
- h&=-1-0x8000;
if(h>=MAX_WAD) ERR_fatal("M_lock: странный номер ресурса");
if(!resl[h]) if(!resp[h]) allocres(h);
++resl[h];
return resp[h];
}
-void M_unlock(void *p) {
+void M_unlock (void *p) {
int h;
if(!p) return;
}
int M_locked (int h) {
- h&=-1-0x8000;
return (h != -1) && (h != 0xFFFF) && (resl[h] != 0);
}
int M_was_locked (int h) {
- h&=-1-0x8000;
return (h != -1) && (h != 0xFFFF) && (resp[h] != NULL);
}