Merge pull request #82 from penfold42/hexoptions

3 small things
This commit is contained in:
Stephen White 2018-08-30 21:41:56 +10:00 committed by GitHub
commit 756bbe2a02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 26 deletions

View file

@ -1159,6 +1159,12 @@ bool FileBrowser::MakeLST(const char* filenameLST)
} }
} }
f_write(&fp
, roms->ROMNames[roms->currentROMIndex]
, strlen(roms->ROMNames[roms->currentROMIndex])
, &bytes);
f_write(&fp, "\r\n", 2, &bytes);
f_close(&fp); f_close(&fp);
} }
else else

View file

@ -23,8 +23,8 @@
extern "C" extern "C"
{ {
#include "rpi-aux.h" #include "rpi-aux.h"
extern void reboot_now(void);
} }
extern void Reboot_Pi(void);
// If disk swaps can be done via multiple cores then directDiskSwapRequest needs to be volatile. WARNING: volatile acesses can be very expensive. // If disk swaps can be done via multiple cores then directDiskSwapRequest needs to be volatile. WARNING: volatile acesses can be very expensive.
//volatile unsigned InputMappings::directDiskSwapRequest = 0; //volatile unsigned InputMappings::directDiskSwapRequest = 0;
@ -204,7 +204,7 @@ bool InputMappings::CheckKeyboardBrowseMode()
} }
if (keyboard->KeyHeld(KEY_DELETE) && keyboard->KeyLCtrlAlt() ) if (keyboard->KeyHeld(KEY_DELETE) && keyboard->KeyLCtrlAlt() )
reboot_now(); Reboot_Pi();
if (keyboard->KeyHeld(KEY_ESC)) if (keyboard->KeyHeld(KEY_ESC))
SetKeyboardFlag(ESC_FLAG); SetKeyboardFlag(ESC_FLAG);
@ -295,7 +295,7 @@ void InputMappings::CheckKeyboardEmulationMode(unsigned numberOfImages, unsigned
return; return;
if (keyboard->KeyHeld(KEY_DELETE) && keyboard->KeyLCtrlAlt() ) if (keyboard->KeyHeld(KEY_DELETE) && keyboard->KeyLCtrlAlt() )
reboot_now(); Reboot_Pi();
if (keyboard->KeyHeld(KEY_ESC)) if (keyboard->KeyHeld(KEY_ESC))
SetKeyboardFlag(ESC_FLAG); SetKeyboardFlag(ESC_FLAG);

View file

@ -47,9 +47,7 @@
extern unsigned versionMajor; extern unsigned versionMajor;
extern unsigned versionMinor; extern unsigned versionMinor;
extern "C" { extern void Reboot_Pi();
extern void reboot_now(void);
}
#define WaitWhile(checkStatus) \ #define WaitWhile(checkStatus) \
do\ do\
@ -1232,7 +1230,7 @@ void IEC_Commands::User(void)
break; break;
case 202: case 202:
// Really hard reset - reboot Pi // Really hard reset - reboot Pi
reboot_now(); Reboot_Pi();
break; break;
case '0': case '0':
//OPEN1,8,15,"U0>"+CHR$(9):CLOSE1 //OPEN1,8,15,"U0>"+CHR$(9):CLOSE1

View file

@ -1291,6 +1291,13 @@ static void CheckOptions()
} }
} }
void Reboot_Pi()
{
if (screenLCD)
screenLCD->ClearInit(0);
reboot_now();
}
extern "C" extern "C"
{ {
void kernel_main(unsigned int r0, unsigned int r1, unsigned int atags) void kernel_main(unsigned int r0, unsigned int r1, unsigned int atags)

View file

@ -299,26 +299,9 @@ void Options::Process(char* buffer)
unsigned Options::GetDecimal(char* pString) unsigned Options::GetDecimal(char* pString)
{ {
if (pString == 0 || *pString == '\0') if (pString == 0 || *pString == '\0')
return INVALID_VALUE; return 0;
unsigned nResult = 0; return strtol(pString, NULL, 0);
char chChar = *pString++;
while (chChar != '\0' && chChar != 13)
{
if (!('0' <= chChar && chChar <= '9'))
return INVALID_VALUE;
unsigned nPrevResult = nResult;
nResult = nResult * 10 + (chChar - '0');
if (nResult < nPrevResult || nResult == INVALID_VALUE)
return INVALID_VALUE;
chChar = *pString++;
}
return nResult;
} }
float Options::GetFloat(char* pString) float Options::GetFloat(char* pString)