From 678786c893ec1866688fa9c5092081a38ecf0e13 Mon Sep 17 00:00:00 2001 From: dborth Date: Wed, 17 Mar 2010 05:34:26 +0000 Subject: [PATCH] correct rom allocation --- source/ngc/inputmetroid.cpp | 8 ++++++++ source/ngc/vba.cpp | 3 +++ source/ngc/vbasupport.cpp | 14 ++------------ source/ngc/vmmem.cpp | 4 ---- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/source/ngc/inputmetroid.cpp b/source/ngc/inputmetroid.cpp index 9186b83..8c100b0 100644 --- a/source/ngc/inputmetroid.cpp +++ b/source/ngc/inputmetroid.cpp @@ -41,7 +41,9 @@ u32 MetroidZeroInput(unsigned short pad) { OldHealth = Health; static int Morph = 0; +#ifdef HW_RVL static int AimCount = 0; +#endif static int MissileCount = 0; if (BallState == 2) // Can't exit morph ball without pressing C! @@ -422,7 +424,9 @@ u32 MetroidFusionInput(unsigned short pad) { u32 Metroid1Input(unsigned short pad) { u32 J = StandardMovement(pad) | DecodeGamecube(pad) | DecodeClassic(pad); u8 BallState = CPUReadByte(0x3007500); // 3 = ball, other = stand +#ifdef HW_RVL u8 MissileState = CPUReadByte(0x300730E); // 1 = missile, 0 = beam +#endif u16 Health = CPUReadHalfWord(0x3007306); // Binary Coded Decimal static u16 OldHealth = 0; @@ -536,7 +540,9 @@ u32 Metroid1Input(unsigned short pad) { u32 Metroid2Input(unsigned short pad) { u32 J = StandardMovement(pad) | DecodeGamecube(pad) | DecodeClassic(pad); u8 BallState = gbReadMemory(0xD020); // 4 = crouch, 5 = ball, other = stand +#ifdef HW_RVL u8 MissileState = gbReadMemory(0xD04D); // 8 = missile hatch open, 0 = missile closed +#endif u8 Health = gbReadMemory(0xD051); // Binary Coded Decimal static u8 OldHealth = 0; @@ -546,7 +552,9 @@ u32 Metroid2Input(unsigned short pad) { OldHealth = Health; static int Morph = 0; +#ifdef HW_RVL static int AimCount = 0; +#endif if (BallState == 5) // Can't exit morph ball without pressing C! J &= ~VBA_UP; diff --git a/source/ngc/vba.cpp b/source/ngc/vba.cpp index dc84d26..40d5734 100644 --- a/source/ngc/vba.cpp +++ b/source/ngc/vba.cpp @@ -23,6 +23,7 @@ #include "FreeTypeGX.h" +#include "gba/Globals.h" #include "gba/Sound.h" #include "utils/usb2storage.h" @@ -334,6 +335,8 @@ int main(int argc, char *argv[]) #ifdef HW_RVL if(argc > 0 && argv[0] != NULL) CreateAppPath(argv[0]); + + rom = (u8 *)malloc(1024*1024*32); // allocate 32 MB to GBA ROM #endif while(1) // main loop diff --git a/source/ngc/vbasupport.cpp b/source/ngc/vbasupport.cpp index 3ba1ae4..5859834 100644 --- a/source/ngc/vbasupport.cpp +++ b/source/ngc/vbasupport.cpp @@ -47,8 +47,6 @@ #include "preferences.h" #include "fastmath.h" -//#define CARLLOG - static u32 start; int cartridgeType = 0; u32 RomIdCode; @@ -688,14 +686,6 @@ static void gbApplyPerImagePreferences() else strncpy(RomTitle, (const char *) &gbRom[0x134], 15); -#ifdef CARLLOG - if (RomIdCode !=0) { - log("******** %2x \"%c%c%c%c\" \"%s\"", Colour, gbRom[0x13f], gbRom[0x140], gbRom[0x141], gbRom[0x142], title); - } else { - log("******** %2x \"%s\"", Colour, title); - } -#endif - if (RomIdCode == 0) { if (strcmp(RomTitle, "ZELDA") == 0) @@ -860,7 +850,7 @@ extern bool gbUpdateSizes(); bool LoadGBROM() { - gbRom = (u8 *)memalign(32, 1024*1024*4); // allocate 4 MB to GB ROM + gbRom = (u8 *)malloc(1024*1024*4); // allocate 4 MB to GB ROM bios = (u8 *)calloc(1,0x100); systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; @@ -922,7 +912,7 @@ bool LoadVBAROM() if(cartridgeType != 1 && cartridgeType != 2) { // Not zip gba agb gbc cgb sgb gb mb bin elf or dmg! - ErrorPrompt("Invalid filename extension! Not a rom?"); + ErrorPrompt("Unrecognized file extension!"); return false; } diff --git a/source/ngc/vmmem.cpp b/source/ngc/vmmem.cpp index 6fc4aaa..515d28d 100644 --- a/source/ngc/vmmem.cpp +++ b/source/ngc/vmmem.cpp @@ -30,8 +30,6 @@ #define MEM_VM 0x01 #define MEM_UN 0x80 -unsigned int MEM2Storage = 0x91000000; - int GBAROMSize = 0; #ifdef USE_VM @@ -160,8 +158,6 @@ bool VMCPULoadROM() VMAllocGBA(); GBAROMSize = 0; - rom = (u8 *)MEM2Storage; - if(!inSz) { char filepath[1024];