mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-06-17 21:29:42 +00:00
modify for workaround <cannot map RAM:No Error> caused by confliction with MSI afterburner or RIVA Tuner statistic tuner Server
This commit is contained in:
parent
08707d3a25
commit
45e3bd1d3e
|
@ -203,6 +203,50 @@ int main(int argc, char **argv)
|
||||||
// Read preferences
|
// Read preferences
|
||||||
PrefsInit(NULL, argc, argv);
|
PrefsInit(NULL, argc, argv);
|
||||||
|
|
||||||
|
// #chenchijung 2024/2/21: move vm_init(), memory allocation for Mac RAM and Mac ROM here to avoid "cannot map RAM: no Error" bug.
|
||||||
|
// caused by MSI afterburner (RIVA Tuner statistic tuner Server?). It is a workaround since I don't know why. But it works in my test env.
|
||||||
|
//
|
||||||
|
// ------------ Start of workaround --------------
|
||||||
|
int sdl_flags = 0;
|
||||||
|
// Initialize VM system
|
||||||
|
vm_init();
|
||||||
|
|
||||||
|
// Create area for Mac RAM
|
||||||
|
RAMSize = PrefsFindInt32("ramsize");
|
||||||
|
if (RAMSize <= 1000) {
|
||||||
|
RAMSize *= 1024 * 1024;
|
||||||
|
}
|
||||||
|
if (RAMSize < 16 * 1024 * 1024) {
|
||||||
|
WarningAlert(GetString(STR_SMALL_RAM_WARN));
|
||||||
|
RAMSize = 16 * 1024 * 1024;
|
||||||
|
}
|
||||||
|
RAMBase = 0;
|
||||||
|
if (vm_mac_acquire(RAMBase, RAMSize) < 0) {
|
||||||
|
sprintf(str, GetString(STR_RAM_MMAP_ERR), strerror(errno));
|
||||||
|
ErrorAlert(str);
|
||||||
|
goto quit;
|
||||||
|
}
|
||||||
|
RAMBaseHost = Mac2HostAddr(RAMBase);
|
||||||
|
ram_area_mapped = true;
|
||||||
|
D(bug("RAM area at %p (%08x)\n", RAMBaseHost, RAMBase));
|
||||||
|
|
||||||
|
if (RAMBase > ROMBase) {
|
||||||
|
ErrorAlert(GetString(STR_RAM_HIGHER_THAN_ROM_ERR));
|
||||||
|
goto quit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create area for Mac ROM
|
||||||
|
if (vm_mac_acquire(ROM_BASE, ROM_AREA_SIZE) < 0) {
|
||||||
|
sprintf(str, GetString(STR_ROM_MMAP_ERR), strerror(errno));
|
||||||
|
ErrorAlert(str);
|
||||||
|
goto quit;
|
||||||
|
}
|
||||||
|
ROMBase = ROM_BASE;
|
||||||
|
ROMBaseHost = Mac2HostAddr(ROMBase);
|
||||||
|
rom_area_mapped = true;
|
||||||
|
D(bug("ROM area at %p (%08x)\n", ROMBaseHost, ROMBase));
|
||||||
|
//#chenchijung ----------------- end of workaround --------------
|
||||||
|
|
||||||
// Check we are using a Windows NT kernel >= 4.0
|
// Check we are using a Windows NT kernel >= 4.0
|
||||||
OSVERSIONINFO osvi;
|
OSVERSIONINFO osvi;
|
||||||
ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
|
ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
|
||||||
|
@ -232,7 +276,7 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize SDL system
|
// Initialize SDL system
|
||||||
int sdl_flags = 0;
|
sdl_flags = 0; // #chenchijungtw move variable definition forward to avoid complication error
|
||||||
#ifdef USE_SDL_VIDEO
|
#ifdef USE_SDL_VIDEO
|
||||||
sdl_flags |= SDL_INIT_VIDEO;
|
sdl_flags |= SDL_INIT_VIDEO;
|
||||||
#endif
|
#endif
|
||||||
|
@ -260,9 +304,6 @@ int main(int argc, char **argv)
|
||||||
goto quit;
|
goto quit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize VM system
|
|
||||||
vm_init();
|
|
||||||
|
|
||||||
// Get system info
|
// Get system info
|
||||||
PVR = 0x00040000; // Default: 604
|
PVR = 0x00040000; // Default: 604
|
||||||
CPUClockSpeed = 100000000; // Default: 100MHz
|
CPUClockSpeed = 100000000; // Default: 100MHz
|
||||||
|
@ -315,41 +356,6 @@ int main(int argc, char **argv)
|
||||||
goto quit;
|
goto quit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create area for Mac ROM
|
|
||||||
if (vm_mac_acquire(ROM_BASE, ROM_AREA_SIZE) < 0) {
|
|
||||||
sprintf(str, GetString(STR_ROM_MMAP_ERR), strerror(errno));
|
|
||||||
ErrorAlert(str);
|
|
||||||
goto quit;
|
|
||||||
}
|
|
||||||
ROMBase = ROM_BASE;
|
|
||||||
ROMBaseHost = Mac2HostAddr(ROMBase);
|
|
||||||
rom_area_mapped = true;
|
|
||||||
D(bug("ROM area at %p (%08x)\n", ROMBaseHost, ROMBase));
|
|
||||||
|
|
||||||
// Create area for Mac RAM
|
|
||||||
RAMSize = PrefsFindInt32("ramsize");
|
|
||||||
if (RAMSize <= 1000) {
|
|
||||||
RAMSize *= 1024 * 1024;
|
|
||||||
}
|
|
||||||
if (RAMSize < 16 * 1024 * 1024) {
|
|
||||||
WarningAlert(GetString(STR_SMALL_RAM_WARN));
|
|
||||||
RAMSize = 16 * 1024 * 1024;
|
|
||||||
}
|
|
||||||
RAMBase = 0;
|
|
||||||
if (vm_mac_acquire(RAMBase, RAMSize) < 0) {
|
|
||||||
sprintf(str, GetString(STR_RAM_MMAP_ERR), strerror(errno));
|
|
||||||
ErrorAlert(str);
|
|
||||||
goto quit;
|
|
||||||
}
|
|
||||||
RAMBaseHost = Mac2HostAddr(RAMBase);
|
|
||||||
ram_area_mapped = true;
|
|
||||||
D(bug("RAM area at %p (%08x)\n", RAMBaseHost, RAMBase));
|
|
||||||
|
|
||||||
if (RAMBase > ROMBase) {
|
|
||||||
ErrorAlert(GetString(STR_RAM_HIGHER_THAN_ROM_ERR));
|
|
||||||
goto quit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load Mac ROM
|
// Load Mac ROM
|
||||||
rom_path = PrefsFindString("rom");
|
rom_path = PrefsFindString("rom");
|
||||||
rom_fh = CreateFile(rom_path && *rom_path ? rom_path : ROM_FILE_NAME,
|
rom_fh = CreateFile(rom_path && *rom_path ? rom_path : ROM_FILE_NAME,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user