Fix some buggy stuff

This commit is contained in:
meepingsnesroms
2019-05-19 15:55:38 -07:00
parent 1b3336c9af
commit 1d693ae10d
5 changed files with 25 additions and 9 deletions

View File

@@ -254,6 +254,8 @@ uint32_t EmuWrapper::bootFromFileOrDirectory(const QString& mainPath){
launcher_file_t* files;
QFile ramFile(mainPath + ".ram");
QFile sdCardFile(mainPath + ".sd.img");
bool hasSaveRam;
bool hasSaveSdCard;
int newestBootableFile = -1;
if(!wasPaused)
@@ -349,16 +351,18 @@ uint32_t EmuWrapper::bootFromFileOrDirectory(const QString& mainPath){
writeOutSaves();
//its OK if these fail, the buffer will just be NULL, 0 if they do
ramFile.open(QFile::ReadOnly | QFile::ExistingOnly);
sdCardFile.open(QFile::ReadOnly | QFile::ExistingOnly);
hasSaveRam = ramFile.open(QFile::ReadOnly | QFile::ExistingOnly);
hasSaveSdCard = sdCardFile.open(QFile::ReadOnly | QFile::ExistingOnly);
error = launcherLaunch(files, paths.length(), (uint8_t*)ramFile.readAll().data(), ramFile.size(), (uint8_t*)sdCardFile.readAll().data(), sdCardFile.size());
error = launcherLaunch(files, paths.length(), hasSaveRam ? (uint8_t*)ramFile.readAll().data() : NULL, hasSaveRam ? ramFile.size() : 0, hasSaveSdCard ? (uint8_t*)sdCardFile.readAll().data() : NULL, hasSaveSdCard ? sdCardFile.size() : 0);
if(error != EMU_ERROR_NONE)
goto errorOccurred;
//its OK if these fail
ramFile.close();
sdCardFile.close();
if(hasSaveRam)
ramFile.close();
if(hasSaveSdCard)
sdCardFile.close();
//everything worked, set output save files
emuRamFilePath = mainPath + ".ram";

View File

@@ -420,6 +420,8 @@ uint16_t dbvzGetRegister16(uint32_t address){
}
case PLLFSR:
//test this hack again
registerArrayWrite16(PLLFSR, registerArrayRead16(PLLFSR) ^ 0x8000);
return registerArrayRead16(PLLFSR);
//32 bit registers accessed as 16 bit

View File

@@ -115,7 +115,7 @@ uint32_t emulatorInit(uint8_t* palmRomData, uint32_t palmRomSize, uint8_t* palmB
if(palmRomSize < TUNGSTEN_C_ROM_SIZE)
memset(palmRom + palmRomSize, 0x00, TUNGSTEN_C_ROM_SIZE - palmRomSize);
memset(palmRam, 0x00, TUNGSTEN_C_RAM_SIZE);
memset(palmFramebuffer, 0x00, 320 * 320 * sizeof(uint16_t));//TODO:PXA255 code doesnt always output a picture like my SED1376 code
memset(palmFramebuffer, 0x00, 320 * 320 * sizeof(uint16_t));//TODO:PXA255 code doesnt always output a picture like my SED1376 code, so clear the buffer to prevent garbage from being displayed before the first render
memset(palmAudio, 0x00, AUDIO_SAMPLES_PER_FRAME * 2/*channels*/ * sizeof(int16_t));
memset(&palmInput, 0x00, sizeof(palmInput));
memset(&palmMisc, 0x00, sizeof(palmMisc));

View File

@@ -192,13 +192,21 @@ uint32_t launcherLaunch(launcher_file_t* files, uint32_t fileCount, uint8_t* sra
//cant load a card image if an app has been loaded already
if(applicationFileHasBeenLoaded && files[index].type == LAUNCHER_FILE_TYPE_IMG)
return EMU_ERROR_INVALID_PARAMETER;
if(files[index].type == LAUNCHER_FILE_TYPE_IMG)
cardImageHasBeenLoaded = true;
else
applicationFileHasBeenLoaded = true;
//there must be exactly 1 boot file
if(files[index].boot){
if(!bootFileExists)
if(!bootFileExists){
bootFileExists = true;
else
bootFileNum = index;
}
else{
return EMU_ERROR_INVALID_PARAMETER;
}
}
totalSize += files[index].fileSize;
@@ -273,6 +281,7 @@ uint32_t launcherLaunch(launcher_file_t* files, uint32_t fileCount, uint8_t* sra
emulatorSoftReset();
/*
//execute frames until launch is completed(or failed with a time out)
success = false;
palmEmuFeatures.value = 'RUN0';
@@ -287,6 +296,7 @@ uint32_t launcherLaunch(launcher_file_t* files, uint32_t fileCount, uint8_t* sra
//timed out
if(!success)
return EMU_ERROR_RESOURCE_LOCKED;
*/
//worked
return EMU_ERROR_NONE;

View File

@@ -198,7 +198,7 @@ void pxa255Execute(void){
os_faulthandler_arm(&seh_frame);
#endif
//TODO: need to set cycle_count_delta with the amout of opcodes to run
//TODO: need to set cycle_count_delta with the amount of opcodes to run
cycle_count_delta = -500;//just a test value
// clang segfaults with that, for an iOS build :(