aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXaviDCR92 <xavi.dcr@gmail.com>2017-08-11 22:11:43 +0200
committerXaviDCR92 <xavi.dcr@gmail.com>2017-08-11 22:11:43 +0200
commitf97f48ca7cefd3380edc9bdaaebf17c16c5c871b (patch)
tree8fcc3e6cff095ba23ee8f18a9ce4d4c2521436b2
parentf17b15bdffe45810eebc7695c10f1d7fc34af014 (diff)
* IMASK is now accessed as volatile variable.
* Other minor changes.
-rw-r--r--Source/Game.c1
-rw-r--r--Source/Gfx.c5
-rw-r--r--Source/LoadMenu.c38
-rw-r--r--Source/Makefile1
-rw-r--r--Source/System.c7
5 files changed, 30 insertions, 22 deletions
diff --git a/Source/Game.c b/Source/Game.c
index 148b581..74f4706 100644
--- a/Source/Game.c
+++ b/Source/Game.c
@@ -151,7 +151,6 @@ static void GamePlayerAddWaypoint(TYPE_PLAYER* ptrPlayer);
static void GamePlayerAddWaypoint_Ex(TYPE_PLAYER* ptrPlayer, uint16_t tile);
static void GameGraphics(void);
static void GameRenderLevel(TYPE_PLAYER* ptrPlayer);
-//static void GameLoadPilots(char* strPath);
static void GameClock(void);
static void GameClockFlights(uint8_t i);
static void GameAircraftState(uint8_t i);
diff --git a/Source/Gfx.c b/Source/Gfx.c
index a664a12..da1b378 100644
--- a/Source/Gfx.c
+++ b/Source/Gfx.c
@@ -363,9 +363,10 @@ bool GfxSpriteFromFile(char* fname, GsSprite * spr)
gfx_busy = true;
- GsImageFromTim(&gsi,SystemGetBufferAddress() );
+ GsImageFromTim(&gsi, SystemGetBufferAddress() );
- GsSpriteFromImage(spr,&gsi,UPLOAD_IMAGE_FLAG);
+ GsSpriteFromImage(spr, &gsi, UPLOAD_IMAGE_FLAG);
+
gfx_busy = false;
DEBUG_PRINT_VAR(spr->tpage);
diff --git a/Source/LoadMenu.c b/Source/LoadMenu.c
index 0c9bbb1..eb7735f 100644
--- a/Source/LoadMenu.c
+++ b/Source/LoadMenu.c
@@ -456,13 +456,15 @@ void LoadMenuLoadFileList( char* fileList[], void* dest[],
for(fileLoadedCount = 0; fileLoadedCount < szFileList ; fileLoadedCount++)
{
- if(fileList[fileLoadedCount] == NULL)
+ DEBUG_PRINT_VAR(fileLoadedCount);
+
+ strCurrentFile = fileList[fileLoadedCount];
+
+ if(strCurrentFile == NULL)
{
continue;
}
- strCurrentFile = fileList[fileLoadedCount];
-
x_increment = (short)(LOADING_BAR_WIDTH / szFileList);
// Calculate new X position for loading menu plane sprite.
@@ -474,21 +476,21 @@ void LoadMenuLoadFileList( char* fileList[], void* dest[],
//Serial_printf("Files %d / %d loaded. New plane X = %d.\n",fileLoadedCount,szFileList,LoadMenuPlaneSpr.x);
// Backup original file path
- strncpy(aux_file_name,fileList[fileLoadedCount],100);
+ strncpy(aux_file_name, strCurrentFile, 100);
//We want to get file extension, so split into tokens
- strtok(fileList[fileLoadedCount],".;");
- extension = strtok(NULL,".;");
+ strtok(strCurrentFile, ".;");
+ extension = strtok(NULL, ".;");
- Serial_printf("File extension: .%s\n",extension);
+ Serial_printf("File extension: .%s\n", extension);
//Restore original file path in order to load file
- strncpy(fileList[fileLoadedCount],aux_file_name,100);
+ strncpy(strCurrentFile, aux_file_name, 100);
if(strncmp(extension,"TIM",3) == 0)
{
- if(GfxSpriteFromFile(fileList[fileLoadedCount], dest[fileLoadedCount]) == false)
+ if(GfxSpriteFromFile(strCurrentFile, dest[fileLoadedCount]) == false)
{
- Serial_printf("Could not load image file \"%s\"!\n",fileList[fileLoadedCount]);
+ Serial_printf("Could not load image file \"%s\"!\n", strCurrentFile);
}
}
else if(strncmp(extension,"CLT",3) == 0)
@@ -498,30 +500,30 @@ void LoadMenuLoadFileList( char* fileList[], void* dest[],
Serial_printf("WARNING: File %s linked to non-NULL destination pointer!\n", dest[fileLoadedCount]);
}
- if(GfxCLUTFromFile(fileList[fileLoadedCount]) == false)
+ if(GfxCLUTFromFile(strCurrentFile) == false)
{
- Serial_printf("Could not load CLUT file \"%s\"!\n",fileList[fileLoadedCount]);
+ Serial_printf("Could not load CLUT file \"%s\"!\n", strCurrentFile);
}
}
else if(strncmp(extension,"VAG",3) == 0)
{
- if(SfxUploadSound(fileList[fileLoadedCount], dest[fileLoadedCount]) == false)
+ if(SfxUploadSound(strCurrentFile, dest[fileLoadedCount]) == false)
{
- Serial_printf("Could not load sound file \"%s\"!\n",fileList[fileLoadedCount]);
+ Serial_printf("Could not load sound file \"%s\"!\n", strCurrentFile);
}
}
else if(strncmp(extension,"FNT",3) == 0)
{
- if(FontLoadImage(fileList[fileLoadedCount], dest[fileLoadedCount]) == false)
+ if(FontLoadImage(strCurrentFile, dest[fileLoadedCount]) == false)
{
- Serial_printf("Could not load font file \"%s\"!\n",fileList[fileLoadedCount]);
+ Serial_printf("Could not load font file \"%s\"!\n", strCurrentFile);
}
}
else if(strncmp(extension,"PLT",3) == 0)
{
- if(PltParserLoadFile(fileList[fileLoadedCount], dest[fileLoadedCount]) == false)
+ if(PltParserLoadFile(strCurrentFile, dest[fileLoadedCount]) == false)
{
- Serial_printf("Could not load pilots file \"%s\"!\n",fileList[fileLoadedCount]);
+ Serial_printf("Could not load pilots file \"%s\"!\n", strCurrentFile);
}
}
else
diff --git a/Source/Makefile b/Source/Makefile
index 5c47192..d2d7a4d 100644
--- a/Source/Makefile
+++ b/Source/Makefile
@@ -3,6 +3,7 @@ DEFINE= -DFIXMATH_FAST_SIN -D_PAL_MODE_
DEFINE += -DPSXSDK_DEBUG
DEFINE += -DNO_CDDA
DEFINE += -DNO_INTRO
+
#DEFINE += -DSERIAL_INTERFACE
PSXSDK_PATH = /usr/local/psxsdk
LIBS= -lfixmath
diff --git a/Source/System.c b/Source/System.c
index 1830582..e3dbb86 100644
--- a/Source/System.c
+++ b/Source/System.c
@@ -19,7 +19,7 @@
#define END_STACK_PATTERN (uint32_t) 0x18022015
#define BEGIN_STACK_ADDRESS (uint32_t*) 0x801FFF00
#define STACK_SIZE 0x1000
-#define I_MASK (*(unsigned int*)0x1F801074)
+#define I_MASK (*(volatile unsigned int*)0x1F801074)
/* *************************************
* Local Prototypes
@@ -558,6 +558,11 @@ void SystemWaitCycles(uint32_t cycles)
uint32_t SystemRand(uint32_t min, uint32_t max)
{
+ if(rand_seed == false)
+ {
+ Serial_printf("Warning: calling rand() before srand()\n");
+ }
+
return rand() % (max - min + 1) + min;
}