X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fmemory.c;h=9019586e75d866a11d339368f3f2f515e2a4bb52;hb=cf509314ff0bc57488cbeeec0b1c98d88fb027a4;hp=5c7953cc813ee93a99753ff327c2618352bd54da;hpb=ea7819e2f4224e9a5c9be063f9524c8e67a94c36;p=flatwaifu.git
diff --git a/src/memory.c b/src/memory.c
index 5c7953c..9019586 100644
--- a/src/memory.c
+++ b/src/memory.c
@@ -1,92 +1,35 @@
-/*
- Copyright (C) Prikol Software 1996-1997
- Copyright (C) Aleksey Volynskov 1996-1997
+/* 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 .
+ */
- 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 or
- write to the Free Software Foundation, Inc.,
- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#include "glob.h"
-#include
-#include
-#include
-#include "error.h"
-#include "files.h"
#include "memory.h"
+#include "common/wadres.h"
-dword dpmi_memavl(void);
-
-extern int d_start,d_end;
-
-extern mwad_t wad[];
-
-static byte m_active=FALSE;
-
-static void *resp[MAX_WAD];
-static short resl[MAX_WAD];
-
-void M_startup(void) {
- if(m_active) return;
- logo("M_startup: наÑÑÑойка памÑÑи\n");
- memset(resp,0,sizeof(resp));
- memset(resl,0,sizeof(resl));
- // logo(" Ñвободно DPMI-памÑÑи: %uK\n",dpmi_memavl()>>10);
- m_active=TRUE;
+void *M_lock (int id) {
+ return WADRES_lock(id);
}
-void M_shutdown(void) {
-
- if(!m_active) return;
- m_active=FALSE;
+void M_unlock (void *p) {
+ WADRES_unlock(p);
}
-static void allocres(int h) {
- int *p,s;
-
- if(h>d_start && 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) {
- int h;
-
- if(!p) return;
- h=((int*)p)[-1];
- if(h>=MAX_WAD) ERR_fatal("M_unlock: ÑÑÑаннÑй Ð½Ð¾Ð¼ÐµÑ ÑеÑÑÑÑа");
- if(!resl[h]) return;
- --resl[h];
+int M_was_locked (int id) {
+ return WADRES_was_locked(id);
}