Merge branch 'deviceID' into autonewdisk
Conflicts: src/main.cpp
This commit is contained in:
commit
1039cca757
5 changed files with 32 additions and 18 deletions
|
@ -40,9 +40,11 @@ extern Options options;
|
|||
#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,
|
||||
|
@ -53,7 +55,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[] =
|
||||
|
@ -375,7 +378,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)
|
||||
|
@ -908,18 +911,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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1041,7 +1051,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);
|
||||
}
|
||||
|
||||
|
|
|
@ -166,7 +166,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();
|
||||
|
@ -188,8 +188,6 @@ public:
|
|||
|
||||
void ClearScreen();
|
||||
|
||||
void SetDeviceID(u8 id) { deviceID = id; }
|
||||
|
||||
static const long int LSTBuffer_size = 1024 * 8;
|
||||
static unsigned char LSTBuffer[];
|
||||
|
||||
|
@ -230,7 +228,7 @@ private:
|
|||
bool selectionsMade;
|
||||
const char* lastSelectionName;
|
||||
ROMs* roms;
|
||||
unsigned deviceID;
|
||||
u8* deviceID;
|
||||
bool displayPNGIcons;
|
||||
|
||||
BrowsableList caddySelections;
|
||||
|
|
|
@ -175,7 +175,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];
|
||||
|
|
16
src/main.cpp
16
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();
|
||||
|
||||
|
@ -790,8 +797,7 @@ 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 emulated VIA know
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue