Add beta2 patch: Some hack to make SKYRICA work. (allocate a zero xms page to get a pointer to xms memory area)
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2736
This commit is contained in:
parent
0cca0c96cf
commit
779ab9f715
3 changed files with 16 additions and 5 deletions
|
@ -44,6 +44,7 @@ Bitu MEM_FreeLargest(void); //Largest free 4 kb pages block
|
|||
Bitu MEM_TotalPages(void); //Total amount of 4 kb pages
|
||||
Bitu MEM_AllocatedPages(MemHandle handle); // amount of allocated pages of handle
|
||||
MemHandle MEM_AllocatePages(Bitu pages,bool sequence);
|
||||
MemHandle MEM_GetNextFreePage(void);
|
||||
PhysPt MEM_AllocatePage(void);
|
||||
void MEM_ReleasePages(MemHandle handle);
|
||||
bool MEM_ReAllocatePages(MemHandle & handle,Bitu pages,bool sequence);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: memory.cpp,v 1.46 2007-01-08 19:45:40 qbix79 Exp $ */
|
||||
/* $Id: memory.cpp,v 1.47 2007-01-08 21:40:15 qbix79 Exp $ */
|
||||
|
||||
#include "dosbox.h"
|
||||
#include "mem.h"
|
||||
|
@ -291,6 +291,10 @@ MemHandle MEM_AllocatePages(Bitu pages,bool sequence) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
MemHandle MEM_GetNextFreePage(void) {
|
||||
return (MemHandle)BestMatch(1);
|
||||
}
|
||||
|
||||
void MEM_ReleasePages(MemHandle handle) {
|
||||
while (handle>0) {
|
||||
MemHandle next=memory.mhandles[handle];
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: xms.cpp,v 1.45 2007-01-08 20:10:34 qbix79 Exp $ */
|
||||
/* $Id: xms.cpp,v 1.46 2007-01-08 21:40:15 qbix79 Exp $ */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -134,9 +134,15 @@ Bitu XMS_AllocateMemory(Bitu size, Bit16u& handle) { // size = kb
|
|||
while (!xms_handles[index].free) {
|
||||
if (++index>=XMS_HANDLES) return XMS_OUT_OF_HANDLES;
|
||||
}
|
||||
Bitu pages=(size/4) + ((size & 3) ? 1 : 0);
|
||||
MemHandle mem=MEM_AllocatePages(pages,true);
|
||||
if ((!mem) && (size != 0)) return XMS_OUT_OF_SPACE;
|
||||
MemHandle mem;
|
||||
if (size!=0) {
|
||||
Bitu pages=(size/4) + ((size & 3) ? 1 : 0);
|
||||
mem=MEM_AllocatePages(pages,true);
|
||||
if (!mem) return XMS_OUT_OF_SPACE;
|
||||
} else {
|
||||
mem=MEM_GetNextFreePage();
|
||||
if (mem==0) LOG(LOG_MISC,LOG_ERROR)("XMS:Allocate zero pages with no memory left");
|
||||
}
|
||||
xms_handles[index].free=false;
|
||||
xms_handles[index].mem=mem;
|
||||
xms_handles[index].locked=0;
|
||||
|
|
Loading…
Add table
Reference in a new issue