* IMASK is now accessed as volatile variable.

* Other minor changes.
This commit is contained in:
XaviDCR92 2017-08-11 22:11:43 +02:00
parent f17b15bdff
commit f97f48ca7c
5 changed files with 30 additions and 22 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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;
}