diff --git a/qtBuildSystem/Mu/mainwindow.cpp b/qtBuildSystem/Mu/mainwindow.cpp index a3b0dc8..222600c 100644 --- a/qtBuildSystem/Mu/mainwindow.cpp +++ b/qtBuildSystem/Mu/mainwindow.cpp @@ -87,7 +87,7 @@ MainWindow::MainWindow(QWidget* parent) : settings->setValue("hideOnscreenKeys", true); #endif } - hideOnscreenKeys = settings->value("hideOnscreenKeys", "").toBool(); + hideOnscreenKeys = settings->value("hideOnscreenKeys", false).toBool(); //this makes the display window and button icons resize properly ui->centralWidget->installEventFilter(this); @@ -205,7 +205,7 @@ void MainWindow::popupInformationDialog(const QString& info){ } void MainWindow::redraw(){ - bool hideOnscreenKeys = settings->value("hideOnscreenKeys", "").toBool(); + bool hideOnscreenKeys = settings->value("hideOnscreenKeys", false).toBool(); QResizeEvent* resizeEvent = new QResizeEvent(ui->centralWidget->size(), ui->centralWidget->size()); //update current keys @@ -236,7 +236,7 @@ bool MainWindow::eventFilter(QObject* object, QEvent* event){ if(object->objectName() == "centralWidget"){ float smallestRatio; - bool hideOnscreenKeys = settings->value("hideOnscreenKeys", "").toBool(); + bool hideOnscreenKeys = settings->value("hideOnscreenKeys", false).toBool(); //update displayContainer first, make the display occupy the top 3/5 of the screen if there are Palm keys or 4/5 if theres not ui->displayContainer->setFixedHeight(ui->centralWidget->height() * (hideOnscreenKeys ? 0.80 : 0.60)); diff --git a/qtBuildSystem/Mu/settingsmanager.cpp b/qtBuildSystem/Mu/settingsmanager.cpp index 420a64c..87b46c0 100644 --- a/qtBuildSystem/Mu/settingsmanager.cpp +++ b/qtBuildSystem/Mu/settingsmanager.cpp @@ -21,7 +21,7 @@ SettingsManager::SettingsManager(QWidget* parent) : //set all GUI items to current config values ui->homeDirectory->setText(settings->value("resourceDirectory", "").toString()); - ui->showOnscreenKeys->setChecked(!settings->value("hideOnscreenKeys", "").toBool()); + ui->showOnscreenKeys->setChecked(!settings->value("hideOnscreenKeys", false).toBool()); ui->feature128mbRam->setChecked(settings->value("feature128mbRam", false).toBool()); ui->featureFastCpu->setChecked(settings->value("featureFastCpu", false).toBool()); diff --git a/tools/palm/muExpansionDriver/config.h b/tools/palm/muExpansionDriver/config.h index ff40b95..a4cafe6 100644 --- a/tools/palm/muExpansionDriver/config.h +++ b/tools/palm/muExpansionDriver/config.h @@ -7,11 +7,6 @@ #define APP_NAME "MuExpDriver" #define APP_ID 'MuDv' -#define FUNCTION_BLOB_TYPE 'func' -#define ARM_EXIT_FUNC_ID 0x0000 -#define ARM_CALL_68K_FUNC_ID 0x0001 -#define M68K_CALL_WITH_BLOB_FUNC_ID 0x0002 - /*config vars*/ enum{ USER_WARNING_GIVEN = 0, diff --git a/tools/palm/muExpansionDriver/palmGlobalDefines.h b/tools/palm/muExpansionDriver/palmGlobalDefines.h index da51ec2..7934dc5 100644 --- a/tools/palm/muExpansionDriver/palmGlobalDefines.h +++ b/tools/palm/muExpansionDriver/palmGlobalDefines.h @@ -6,6 +6,7 @@ #define CODE_SECTION(codeSection) __attribute__((section(codeSection))) #define NO_RETURN __attribute__((noreturn)) #define ALIGN(size) __attribute__((aligned(size))) +#define PACKED __attribute__((packed)) #define FIXED_ADDRESS_VAR(a, t) (*((volatile t*)a)) #define readArbitraryMemory8(address) (*((volatile uint8_t*)(address))) diff --git a/tools/palm/muExpansionDriver/palmOsPriv.h b/tools/palm/muExpansionDriver/palmOsPriv.h index 9485acb..1144b85 100644 --- a/tools/palm/muExpansionDriver/palmOsPriv.h +++ b/tools/palm/muExpansionDriver/palmOsPriv.h @@ -1,6 +1,7 @@ #ifndef PALM_OS_PRIV_H #define PALM_OS_PRIV_H +#include #include "palmGlobalDefines.h" /*these are all the Palm OS varibles the SDK dosent expose that I have found while decompiling Palm OS*/ @@ -12,6 +13,7 @@ #define ResetVector FIXED_ADDRESS_VAR(0x00000004, void*) /*OS*/ +#define TrapTablePtr FIXED_ADDRESS_VAR(0x00000122, uint32_t*) #define ScrStatePtr FIXED_ADDRESS_VAR(0x00000164, void*) #endif diff --git a/tools/palm/muExpansionDriver/patcher.c b/tools/palm/muExpansionDriver/patcher.c index fe11f7a..50d1f9c 100644 --- a/tools/palm/muExpansionDriver/patcher.c +++ b/tools/palm/muExpansionDriver/patcher.c @@ -28,6 +28,34 @@ static void lockCodeXXXX(void){ } } +static void resizeTrapTable(void){ + uint16_t oldSr; + uint32_t* oldTrapTable; + uint32_t* newTrapTable; + + /*order and time sensitive code!!!*/ + oldSr = SysDisableInts(); + + /*get new trap table memory*/ + newTrapTable = MemChunkNew(0, (sysTrapLastTrapNumber - sysTrapBase) * sizeof(uint32_t), memNewChunkFlagPreLock | memNewChunkFlagNonMovable | memNewChunkFlagAllowLarge); + + /*copy over old OS 4 size trap table and 0 out the OS 5 part*/ + MemMove(newTrapTable, TrapTablePtr, (sysTrapPceNativeCall - sysTrapBase) * sizeof(uint32_t)); + MemSet(newTrapTable + sysTrapPceNativeCall - sysTrapBase, (sysTrapLastTrapNumber - sysTrapPceNativeCall) * sizeof(uint32_t), 0x00); + + /*save old table pointer to free*/ + oldTrapTable = TrapTablePtr + + /*swap the tables*/ + TrapTablePtr = newTrapTable; + + /*free the old table*/ + MemChunkFree(oldTrapTable); + + /*return to normal execution*/ + SysRestoreStatus(oldSr); +} + static void install128mbRam(uint8_t mbDynamicHeap){ /*these functions are called by HwrInit, which can be called directly by apps*/ /*PrvGetRAMSize_10002C5E, small ROM*/ diff --git a/tools/palm/muExpansionDriver/traps.h b/tools/palm/muExpansionDriver/traps.h index 507a3cf..4b5a928 100644 --- a/tools/palm/muExpansionDriver/traps.h +++ b/tools/palm/muExpansionDriver/traps.h @@ -6,9 +6,9 @@ #include "palmGlobalDefines.h" -typedef struct{ +typedef struct PACKED{ + uint32_t linkSp; uint32_t pc; - uint32_t sp; }__return_stack_frame_type; #define __return_stack_frame register __return_stack_frame_type* __stack_frame asm("a6") diff --git a/tools/palm/muExpansionDriver/unimplementedFeatures.txt b/tools/palm/muExpansionDriver/unimplementedFeatures.txt index 897c0ff..384f7b1 100644 --- a/tools/palm/muExpansionDriver/unimplementedFeatures.txt +++ b/tools/palm/muExpansionDriver/unimplementedFeatures.txt @@ -11,6 +11,7 @@ For some reason the new versions of MuExpDriver dont work with Chuzzle anymore Need to allocate a new trap table and set the global to that, not just write off the end of the existing one Need to lock the code resources on boot, databases can be shuffled in RAM to free up space and that will corrupt old trap addresses Need to patch SysGetOSVersionString +Crash on first load when pressing "Emulator", probably caused by accessing the config file wrong Fixed: GUI \ No newline at end of file