Can now change device ID in browse mode with keyboard 8,9,0,- and F8..F11
Maximum rom images is now 7 (down from 8)
This commit is contained in:
parent
1090e509a1
commit
709809281f
5 changed files with 32 additions and 19 deletions
|
@ -35,9 +35,11 @@ extern "C"
|
|||
#define PNG_WIDTH 320
|
||||
#define PNG_HEIGHT 200
|
||||
|
||||
extern void GlobalSetDeviceID(u8 id);
|
||||
|
||||
unsigned char FileBrowser::LSTBuffer[FileBrowser::LSTBuffer_size];
|
||||
|
||||
const unsigned FileBrowser::SwapKeys[30] =
|
||||
const unsigned FileBrowser::SwapKeys[33] =
|
||||
{
|
||||
KEY_F1, KEY_KP1, KEY_1,
|
||||
KEY_F2, KEY_KP2, KEY_2,
|
||||
|
@ -48,7 +50,8 @@ const unsigned FileBrowser::SwapKeys[30] =
|
|||
KEY_F7, KEY_KP7, KEY_7,
|
||||
KEY_F8, KEY_KP8, KEY_8,
|
||||
KEY_F9, KEY_KP9, KEY_9,
|
||||
KEY_F10, KEY_KP0, KEY_0
|
||||
KEY_F10, KEY_KP0, KEY_0,
|
||||
KEY_F11, KEY_KPMINUS, KEY_MINUS
|
||||
};
|
||||
|
||||
static const u32 palette[] =
|
||||
|
@ -370,7 +373,7 @@ FileBrowser::BrowsableList::Entry* FileBrowser::BrowsableList::FindEntry(const c
|
|||
return 0;
|
||||
}
|
||||
|
||||
FileBrowser::FileBrowser(DiskCaddy* diskCaddy, ROMs* roms, unsigned deviceID, bool displayPNGIcons, ScreenBase* screenMain, ScreenBase* screenLCD, float scrollHighlightRate)
|
||||
FileBrowser::FileBrowser(DiskCaddy* diskCaddy, ROMs* roms, u8* deviceID, bool displayPNGIcons, ScreenBase* screenMain, ScreenBase* screenLCD, float scrollHighlightRate)
|
||||
: state(State_Folders)
|
||||
, diskCaddy(diskCaddy)
|
||||
, selectionsMade(false)
|
||||
|
@ -895,18 +898,25 @@ void FileBrowser::UpdateInputFolders()
|
|||
else
|
||||
{
|
||||
unsigned keySetIndex;
|
||||
for (keySetIndex = 0; keySetIndex < ROMs::MAX_ROMS; ++keySetIndex)
|
||||
for (keySetIndex = 0; keySetIndex < 11; ++keySetIndex)
|
||||
{
|
||||
unsigned keySetIndexBase = keySetIndex * 3;
|
||||
if (keyboard->KeyPressed(FileBrowser::SwapKeys[keySetIndexBase]) || keyboard->KeyPressed(FileBrowser::SwapKeys[keySetIndexBase + 1]) || keyboard->KeyPressed(FileBrowser::SwapKeys[keySetIndexBase + 2]))
|
||||
if (keyboard->KeyPressed(FileBrowser::SwapKeys[keySetIndexBase])
|
||||
|| keyboard->KeyPressed(FileBrowser::SwapKeys[keySetIndexBase + 1])
|
||||
|| keyboard->KeyPressed(FileBrowser::SwapKeys[keySetIndexBase + 2]))
|
||||
{
|
||||
if (roms->ROMValid[keySetIndex])
|
||||
if ( (keySetIndex < ROMs::MAX_ROMS) && (roms->ROMValid[keySetIndex]) )
|
||||
{
|
||||
roms->currentROMIndex = keySetIndex;
|
||||
roms->lastManualSelectedROMIndex = keySetIndex;
|
||||
DEBUG_LOG("Swap ROM %d %s\r\n", keySetIndex, roms->ROMNames[keySetIndex]);
|
||||
ShowDeviceAndROM();
|
||||
}
|
||||
else if ( (keySetIndex >= 7) && (keySetIndex <= 10 ) )
|
||||
{
|
||||
GlobalSetDeviceID( keySetIndex+1 );
|
||||
ShowDeviceAndROM();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1028,7 +1038,7 @@ void FileBrowser::ShowDeviceAndROM()
|
|||
u32 x = 0; // 43 * 8
|
||||
u32 y = screenMain->ScaleY(STATUS_BAR_POSITION_Y) - 20;
|
||||
|
||||
snprintf(buffer, 256, "Device %d %s\r\n", deviceID, roms->ROMNames[roms->currentROMIndex]);
|
||||
snprintf(buffer, 256, "Device %2d %s\r\n", *deviceID, roms->ROMNames[roms->currentROMIndex]);
|
||||
screenMain->PrintText(false, x, y, buffer, textColour, bgColour);
|
||||
}
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@ public:
|
|||
std::vector<BrowsableListView> views;
|
||||
};
|
||||
|
||||
FileBrowser(DiskCaddy* diskCaddy, ROMs* roms, unsigned deviceID, bool displayPNGIcons, ScreenBase* screenMain, ScreenBase* screenLCD, float scrollHighlightRate);
|
||||
FileBrowser(DiskCaddy* diskCaddy, ROMs* roms, u8* deviceID, bool displayPNGIcons, ScreenBase* screenMain, ScreenBase* screenLCD, float scrollHighlightRate);
|
||||
|
||||
void AutoSelectImage(const char* image);
|
||||
void DisplayRoot();
|
||||
|
@ -187,8 +187,6 @@ public:
|
|||
|
||||
void ClearScreen();
|
||||
|
||||
void SetDeviceID(u8 id) { deviceID = id; }
|
||||
|
||||
static const long int LSTBuffer_size = 1024 * 8;
|
||||
static unsigned char LSTBuffer[];
|
||||
|
||||
|
@ -229,7 +227,7 @@ private:
|
|||
bool selectionsMade;
|
||||
const char* lastSelectionName;
|
||||
ROMs* roms;
|
||||
unsigned deviceID;
|
||||
u8* deviceID;
|
||||
bool displayPNGIcons;
|
||||
|
||||
BrowsableList caddySelections;
|
||||
|
|
|
@ -173,7 +173,7 @@ bool InputMappings::CheckKeyboardBrowseMode()
|
|||
else
|
||||
{
|
||||
unsigned index;
|
||||
for (index = 0; index < 10; ++index)
|
||||
for (index = 0; index < 11; ++index)
|
||||
{
|
||||
unsigned keySetIndexBase = index * 3;
|
||||
if (keyboard->KeyHeld(FileBrowser::SwapKeys[keySetIndexBase]) || keyboard->KeyHeld(FileBrowser::SwapKeys[keySetIndexBase + 1]) || keyboard->KeyHeld(FileBrowser::SwapKeys[keySetIndexBase + 2]))
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
void ResetCurrentROMIndex();
|
||||
|
||||
static const int ROM_SIZE = 16384;
|
||||
static const int MAX_ROMS = 8;
|
||||
static const int MAX_ROMS = 7;
|
||||
|
||||
unsigned char ROMImages[MAX_ROMS][ROM_SIZE];
|
||||
char ROMNames[MAX_ROMS][256];
|
||||
|
|
17
src/main.cpp
17
src/main.cpp
|
@ -639,8 +639,15 @@ static void PlaySoundDMA()
|
|||
|
||||
static void SetVIAsDeviceID(u8 id)
|
||||
{
|
||||
if (id & 1) pi1541.VIA[0].GetPortB()->SetInput(VIAPORTPINS_DEVSEL0, true);
|
||||
if (id & 2) pi1541.VIA[0].GetPortB()->SetInput(VIAPORTPINS_DEVSEL1, true);
|
||||
pi1541.VIA[0].GetPortB()->SetInput(VIAPORTPINS_DEVSEL0, id & 1);
|
||||
pi1541.VIA[0].GetPortB()->SetInput(VIAPORTPINS_DEVSEL1, id & 2);
|
||||
}
|
||||
|
||||
void GlobalSetDeviceID(u8 id)
|
||||
{
|
||||
deviceID = id;
|
||||
m_IEC_Commands.SetDeviceId(id);
|
||||
SetVIAsDeviceID(id);
|
||||
}
|
||||
|
||||
static void CheckAutoMountImage(EXIT_TYPE reset_reason , FileBrowser* fileBrowser)
|
||||
|
@ -677,7 +684,7 @@ void emulator()
|
|||
roms.lastManualSelectedROMIndex = 0;
|
||||
|
||||
diskCaddy.SetScreen(&screen, screenLCD);
|
||||
fileBrowser = new FileBrowser(&diskCaddy, &roms, deviceID, options.DisplayPNGIcons(), &screen, screenLCD, options.ScrollHighlightRate());
|
||||
fileBrowser = new FileBrowser(&diskCaddy, &roms, &deviceID, options.DisplayPNGIcons(), &screen, screenLCD, options.ScrollHighlightRate());
|
||||
fileBrowser->DisplayRoot();
|
||||
pi1541.Initialise();
|
||||
|
||||
|
@ -788,10 +795,8 @@ void emulator()
|
|||
fileBrowser->FolderChanged();
|
||||
break;
|
||||
case IEC_Commands::DEVICEID_CHANGED:
|
||||
deviceID = m_IEC_Commands.GetDeviceId();
|
||||
fileBrowser->SetDeviceID(deviceID);
|
||||
GlobalSetDeviceID( m_IEC_Commands.GetDeviceId() );
|
||||
fileBrowser->ShowDeviceAndROM();
|
||||
SetVIAsDeviceID(deviceID); // Let the emilated VIA know
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue