correct rom allocation

This commit is contained in:
dborth 2010-03-17 05:34:26 +00:00
parent 8b3068536f
commit 678786c893
4 changed files with 13 additions and 16 deletions

View File

@ -41,7 +41,9 @@ u32 MetroidZeroInput(unsigned short pad) {
OldHealth = Health; OldHealth = Health;
static int Morph = 0; static int Morph = 0;
#ifdef HW_RVL
static int AimCount = 0; static int AimCount = 0;
#endif
static int MissileCount = 0; static int MissileCount = 0;
if (BallState == 2) // Can't exit morph ball without pressing C! 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 Metroid1Input(unsigned short pad) {
u32 J = StandardMovement(pad) | DecodeGamecube(pad) | DecodeClassic(pad); u32 J = StandardMovement(pad) | DecodeGamecube(pad) | DecodeClassic(pad);
u8 BallState = CPUReadByte(0x3007500); // 3 = ball, other = stand u8 BallState = CPUReadByte(0x3007500); // 3 = ball, other = stand
#ifdef HW_RVL
u8 MissileState = CPUReadByte(0x300730E); // 1 = missile, 0 = beam u8 MissileState = CPUReadByte(0x300730E); // 1 = missile, 0 = beam
#endif
u16 Health = CPUReadHalfWord(0x3007306); // Binary Coded Decimal u16 Health = CPUReadHalfWord(0x3007306); // Binary Coded Decimal
static u16 OldHealth = 0; static u16 OldHealth = 0;
@ -536,7 +540,9 @@ u32 Metroid1Input(unsigned short pad) {
u32 Metroid2Input(unsigned short pad) { u32 Metroid2Input(unsigned short pad) {
u32 J = StandardMovement(pad) | DecodeGamecube(pad) | DecodeClassic(pad); u32 J = StandardMovement(pad) | DecodeGamecube(pad) | DecodeClassic(pad);
u8 BallState = gbReadMemory(0xD020); // 4 = crouch, 5 = ball, other = stand u8 BallState = gbReadMemory(0xD020); // 4 = crouch, 5 = ball, other = stand
#ifdef HW_RVL
u8 MissileState = gbReadMemory(0xD04D); // 8 = missile hatch open, 0 = missile closed u8 MissileState = gbReadMemory(0xD04D); // 8 = missile hatch open, 0 = missile closed
#endif
u8 Health = gbReadMemory(0xD051); // Binary Coded Decimal u8 Health = gbReadMemory(0xD051); // Binary Coded Decimal
static u8 OldHealth = 0; static u8 OldHealth = 0;
@ -546,7 +552,9 @@ u32 Metroid2Input(unsigned short pad) {
OldHealth = Health; OldHealth = Health;
static int Morph = 0; static int Morph = 0;
#ifdef HW_RVL
static int AimCount = 0; static int AimCount = 0;
#endif
if (BallState == 5) // Can't exit morph ball without pressing C! if (BallState == 5) // Can't exit morph ball without pressing C!
J &= ~VBA_UP; J &= ~VBA_UP;

View File

@ -23,6 +23,7 @@
#include "FreeTypeGX.h" #include "FreeTypeGX.h"
#include "gba/Globals.h"
#include "gba/Sound.h" #include "gba/Sound.h"
#include "utils/usb2storage.h" #include "utils/usb2storage.h"
@ -334,6 +335,8 @@ int main(int argc, char *argv[])
#ifdef HW_RVL #ifdef HW_RVL
if(argc > 0 && argv[0] != NULL) if(argc > 0 && argv[0] != NULL)
CreateAppPath(argv[0]); CreateAppPath(argv[0]);
rom = (u8 *)malloc(1024*1024*32); // allocate 32 MB to GBA ROM
#endif #endif
while(1) // main loop while(1) // main loop

View File

@ -47,8 +47,6 @@
#include "preferences.h" #include "preferences.h"
#include "fastmath.h" #include "fastmath.h"
//#define CARLLOG
static u32 start; static u32 start;
int cartridgeType = 0; int cartridgeType = 0;
u32 RomIdCode; u32 RomIdCode;
@ -688,14 +686,6 @@ static void gbApplyPerImagePreferences()
else else
strncpy(RomTitle, (const char *) &gbRom[0x134], 15); 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 (RomIdCode == 0)
{ {
if (strcmp(RomTitle, "ZELDA") == 0) if (strcmp(RomTitle, "ZELDA") == 0)
@ -860,7 +850,7 @@ extern bool gbUpdateSizes();
bool LoadGBROM() 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); bios = (u8 *)calloc(1,0x100);
systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED;
@ -922,7 +912,7 @@ bool LoadVBAROM()
if(cartridgeType != 1 && cartridgeType != 2) if(cartridgeType != 1 && cartridgeType != 2)
{ {
// Not zip gba agb gbc cgb sgb gb mb bin elf or dmg! // 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; return false;
} }

View File

@ -30,8 +30,6 @@
#define MEM_VM 0x01 #define MEM_VM 0x01
#define MEM_UN 0x80 #define MEM_UN 0x80
unsigned int MEM2Storage = 0x91000000;
int GBAROMSize = 0; int GBAROMSize = 0;
#ifdef USE_VM #ifdef USE_VM
@ -160,8 +158,6 @@ bool VMCPULoadROM()
VMAllocGBA(); VMAllocGBA();
GBAROMSize = 0; GBAROMSize = 0;
rom = (u8 *)MEM2Storage;
if(!inSz) if(!inSz)
{ {
char filepath[1024]; char filepath[1024];