Publish VCC Plus OSS source distribution for 3.6.2 build 60
This commit is contained in:
commit
c652a5276d
1192 files changed
+272368
No files matched your search
@@ -0,0 +1,341 @@
|
||||
//#define USE_LOGGING
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright 2015 by Joseph Forgione
|
||||
// This file is part of VCC (Virtual Color Computer).
|
||||
//
|
||||
// VCC (Virtual Color Computer) is free software: you can redistribute itand/or
|
||||
// modify it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// VCC (Virtual Color Computer) is distributed in the hope that it will be
|
||||
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
// Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along with
|
||||
// VCC (Virtual Color Computer). If not, see <http://www.gnu.org/licenses/>.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#include "configuration_dialog.h"
|
||||
#include "mpi.h"
|
||||
#include "resource.h"
|
||||
#include <vcc/util/DialogOps.h>
|
||||
#include <vcc/util/critical_section.h>
|
||||
#include <vcc/util/filesystem.h>
|
||||
#include <vcc/util/logger.h>
|
||||
#include <vcc/bus/cartridge_messages.h>
|
||||
#include <array>
|
||||
|
||||
namespace
|
||||
{
|
||||
using cartridge_loader_status = VCC::Core::cartridge_loader_status;
|
||||
|
||||
struct cartridge_ui_element_identifiers
|
||||
{
|
||||
UINT edit_box_id;
|
||||
UINT radio_button_id;
|
||||
UINT insert_button_id;
|
||||
};
|
||||
|
||||
const std::array<cartridge_ui_element_identifiers, NUMSLOTS> gSlotUiElementIds = { {
|
||||
{ IDC_EDIT1, IDC_SELECT1, IDC_INSERT1 },
|
||||
{ IDC_EDIT2, IDC_SELECT2, IDC_INSERT2 },
|
||||
{ IDC_EDIT3, IDC_SELECT3, IDC_INSERT3 },
|
||||
{ IDC_EDIT4, IDC_SELECT4, IDC_INSERT4 }
|
||||
} };
|
||||
}
|
||||
|
||||
configuration_dialog::configuration_dialog(
|
||||
multipak_configuration& configuration,
|
||||
multipak_supervisor& mpi)
|
||||
:
|
||||
configuration_(configuration),
|
||||
mpi_(mpi)
|
||||
{}
|
||||
|
||||
// Array for slot names
|
||||
struct slot_info {
|
||||
std::string name{};
|
||||
uint32_t type; // 0==empty or Null
|
||||
};
|
||||
std::array<slot_info,5> gSlots{};
|
||||
|
||||
void configuration_dialog::open()
|
||||
{
|
||||
if (!dialog_handle_)
|
||||
{
|
||||
dialog_handle_ = CreateDialogParam(
|
||||
gModuleInstance,
|
||||
MAKEINTRESOURCE(IDD_DIALOG1),
|
||||
GetActiveWindow(),
|
||||
callback_procedure,
|
||||
reinterpret_cast<LPARAM>(this));
|
||||
}
|
||||
ShowWindow(dialog_handle_, SW_SHOWNORMAL);
|
||||
}
|
||||
|
||||
void configuration_dialog::close()
|
||||
{
|
||||
CloseCartDialog(dialog_handle_);
|
||||
}
|
||||
|
||||
void configuration_dialog::select_new_cartridge(unsigned int item)
|
||||
{
|
||||
size_t slot = slot_to_load_;
|
||||
|
||||
FileDialog dlg;
|
||||
|
||||
int cart_type = (item == IDC_LOAD_DLL) ? 1:0; //1=dll,0=rom
|
||||
|
||||
if (cart_type == 1) {
|
||||
dlg.setTitle("Load Hardware Pak");
|
||||
dlg.setInitialDir(configuration_.last_accessed_dll_path().c_str());
|
||||
dlg.setFilter(
|
||||
"Hardware Pak (*.dll)\0*.dll\0"
|
||||
"Rom Pak (*.rom; *.ccc; *.pak)\0*.rom;*.ccc;*.pak\0"
|
||||
"All Pak Types (*.dll; *.rom; *.ccc; *.pak)\0*.dll;*.ccc;*.rom;*.pak\0"
|
||||
"\0");
|
||||
} else {
|
||||
dlg.setTitle("Load Rom Pak");
|
||||
dlg.setInitialDir(configuration_.last_accessed_rom_path().c_str());
|
||||
dlg.setFilter(
|
||||
"Rom Pak (*.rom; *.ccc; *.pak)\0*.rom;*.ccc;*.pak\0"
|
||||
"Hardware Pak (*.dll)\0*.dll\0"
|
||||
"All Pak Types (*.dll; *.rom; *.ccc; *.pak)\0*.dll;*.ccc;*.rom;*.pak\0"
|
||||
"\0");
|
||||
}
|
||||
dlg.setFlags(OFN_FILEMUSTEXIST);
|
||||
|
||||
if (dlg.show(0, dialog_handle_)) {
|
||||
|
||||
SendUnloadSlot(gVccWnd, slot+1); // Slot is 1-4
|
||||
|
||||
DLOG_C("MMI Config mount cartridge %d, %s\n",slot+1,dlg.path());
|
||||
|
||||
CartLoadRequest slotData{};
|
||||
strcpy_s(slotData.pluginPath, slotData.size, dlg.path());
|
||||
|
||||
if (SendLoadSlot(gVccWnd, slot+1, slotData) )
|
||||
{
|
||||
configuration_.slot_cartridge_path(slot, dlg.path());
|
||||
// Update default module directory setting
|
||||
if (cart_type == 1) {
|
||||
configuration_.last_accessed_dll_path(dlg.getdir());
|
||||
} else {
|
||||
configuration_.last_accessed_rom_path(dlg.getdir());
|
||||
}
|
||||
}
|
||||
}
|
||||
update_slot_details(slot);
|
||||
}
|
||||
|
||||
void configuration_dialog::set_selected_slot(size_t slot)
|
||||
{
|
||||
// Get cart description if there is a cart in the slot
|
||||
// Sends message to pakinterface requesting the description
|
||||
CartDescReply rpy;
|
||||
GetCartDesc(gVccWnd, slot+1, rpy);
|
||||
|
||||
SendDlgItemMessage(
|
||||
dialog_handle_,
|
||||
IDC_MODINFO,
|
||||
WM_SETTEXT,
|
||||
0,
|
||||
reinterpret_cast<LPARAM>(rpy.description)
|
||||
);
|
||||
|
||||
for (auto ndx(0u); ndx < gSlotUiElementIds.size(); ndx++)
|
||||
{
|
||||
SendDlgItemMessage(
|
||||
dialog_handle_,
|
||||
gSlotUiElementIds[ndx].radio_button_id,
|
||||
BM_SETCHECK,
|
||||
ndx == slot,
|
||||
0);
|
||||
}
|
||||
|
||||
mpi_.switch_to_slot(slot);
|
||||
configuration_.selected_slot(slot);
|
||||
}
|
||||
|
||||
void configuration_dialog::update_slot_details(size_t slot)
|
||||
{
|
||||
// Get cart name if there is a cart in the slot
|
||||
// Sends message to pakinterface requesting the name
|
||||
CartNameReply rpy;
|
||||
GetCartName(gVccWnd, slot+1, rpy);
|
||||
SendDlgItemMessage(
|
||||
dialog_handle_,
|
||||
gSlotUiElementIds[slot].edit_box_id,
|
||||
WM_SETTEXT,
|
||||
0,
|
||||
reinterpret_cast<LPARAM>(rpy.name)
|
||||
);
|
||||
|
||||
gSlots[slot].name = rpy.name;
|
||||
|
||||
// Kluge until slot type is in base cart object
|
||||
// and a request from pakinterface to obtain it
|
||||
// zero implies the null or empty cartridge
|
||||
gSlots[slot].type = rpy.name[0] ? 1 : 0;
|
||||
|
||||
SendDlgItemMessage(
|
||||
dialog_handle_,
|
||||
gSlotUiElementIds[slot].insert_button_id,
|
||||
WM_SETTEXT,
|
||||
0,
|
||||
reinterpret_cast<LPARAM>(gSlots[slot].type==0 ? ">" : "X")
|
||||
);
|
||||
}
|
||||
|
||||
// This could be expanded to include MRU, etc
|
||||
void configuration_dialog::cart_type_menu(unsigned int Button)
|
||||
{
|
||||
HWND hDlg = dialog_handle_;
|
||||
HWND hButton = GetDlgItem(hDlg, Button);
|
||||
RECT rcButton;
|
||||
GetWindowRect(hButton, &rcButton);
|
||||
HMENU hMenuLoaded = LoadMenu(gModuleInstance, MAKEINTRESOURCE(IDD_POPUP_MENU));
|
||||
HMENU hPopupMenu = GetSubMenu(hMenuLoaded, 0);
|
||||
TrackPopupMenu( hPopupMenu,
|
||||
TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RIGHTBUTTON,
|
||||
rcButton.right, rcButton.top, // position in screen coordinates
|
||||
0, hDlg, NULL ); // Reserved, Owner, reserved
|
||||
DestroyMenu(hMenuLoaded);
|
||||
return;
|
||||
}
|
||||
|
||||
void configuration_dialog::eject_or_select_new_cartridge(unsigned int Button)
|
||||
{
|
||||
|
||||
// Disable Slot changes if parent is disabled. This prevents user using the
|
||||
// config dialog to eject a cartridge while VCC main is using a modal dialog
|
||||
// Otherwise user can crash VCC by unloading a disk cart while inserting a disk
|
||||
if (!IsWindowEnabled(parent_handle_))
|
||||
{
|
||||
MessageBox(
|
||||
dialog_handle_,
|
||||
"Cannot change slot content with dialog open",
|
||||
"ERROR",
|
||||
MB_ICONERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
// Determine slot from button ID
|
||||
size_t slot = 0;
|
||||
switch (Button) {
|
||||
case IDC_INSERT1:
|
||||
slot = 0;
|
||||
break;
|
||||
case IDC_INSERT2:
|
||||
slot = 1;
|
||||
break;
|
||||
case IDC_INSERT3:
|
||||
slot = 2;
|
||||
break;
|
||||
case IDC_INSERT4:
|
||||
slot = 3;
|
||||
break;
|
||||
}
|
||||
|
||||
// type 0 means no slot
|
||||
// TODO slot types should be an enum
|
||||
if (gSlots[slot].type != 0)
|
||||
{
|
||||
// This probably does not belong except
|
||||
// mpi_ does need to maintain a cartridge list
|
||||
// mpi_.eject_cartridge(slot);
|
||||
SendUnloadSlot(gVccWnd, slot+1); // Slot is 1-4
|
||||
SendMessage(gVccWnd,WM_VCC_UPD_MENU,(WPARAM) 0,(LPARAM) 0);
|
||||
|
||||
configuration_.slot_cartridge_path(slot, {});
|
||||
update_slot_details(slot);
|
||||
}
|
||||
else
|
||||
{
|
||||
slot_to_load_ = slot;
|
||||
cart_type_menu(Button);
|
||||
}
|
||||
}
|
||||
|
||||
INT_PTR CALLBACK configuration_dialog::callback_procedure(
|
||||
HWND hDlg,
|
||||
UINT message,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
if (message == WM_INITDIALOG)
|
||||
{
|
||||
SetWindowLongPtr(hDlg, GWLP_USERDATA, lParam);
|
||||
}
|
||||
|
||||
auto dialog(reinterpret_cast<configuration_dialog*>(GetWindowLongPtr(hDlg, GWLP_USERDATA)));
|
||||
|
||||
return dialog->process_message(hDlg, message, wParam);
|
||||
}
|
||||
|
||||
INT_PTR configuration_dialog::process_message(
|
||||
HWND hDlg,
|
||||
UINT message,
|
||||
WPARAM wParam)
|
||||
{
|
||||
unsigned int button;
|
||||
switch (message)
|
||||
{
|
||||
case WM_CLOSE:
|
||||
DestroyWindow(hDlg);
|
||||
dialog_handle_ = nullptr;
|
||||
parent_handle_ = nullptr;
|
||||
return TRUE;
|
||||
|
||||
case WM_INITDIALOG:
|
||||
dialog_handle_ = hDlg;
|
||||
parent_handle_ = GetParent(hDlg);
|
||||
CenterDialog(hDlg);
|
||||
for (int slot = 0; slot < NUMSLOTS; slot++)
|
||||
{
|
||||
update_slot_details(slot);
|
||||
}
|
||||
// Tell pakinterface switch position
|
||||
set_selected_slot(mpi_.selected_switch_slot());
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
button = LOWORD(wParam);
|
||||
switch (button)
|
||||
{
|
||||
case IDC_SELECT1:
|
||||
set_selected_slot(0);
|
||||
return TRUE;
|
||||
case IDC_SELECT2:
|
||||
set_selected_slot(1);
|
||||
return TRUE;
|
||||
case IDC_SELECT3:
|
||||
set_selected_slot(2);
|
||||
return TRUE;
|
||||
case IDC_SELECT4:
|
||||
set_selected_slot(3);
|
||||
return TRUE;
|
||||
case IDC_INSERT1:
|
||||
case IDC_INSERT2:
|
||||
case IDC_INSERT3:
|
||||
case IDC_INSERT4:
|
||||
eject_or_select_new_cartridge(button);
|
||||
return TRUE;
|
||||
case IDC_LOAD_DLL:
|
||||
case IDC_LOAD_ROM:
|
||||
select_new_cartridge(button);
|
||||
return TRUE;
|
||||
case IDC_RESET:
|
||||
SendHardReset(gVccWnd);
|
||||
close();
|
||||
return TRUE;
|
||||
case IDOK:
|
||||
close();
|
||||
return TRUE;
|
||||
} // End switch LOWORD
|
||||
break;
|
||||
} // End switch message
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright 2015 by Joseph Forgione
|
||||
// This file is part of VCC (Virtual Color Computer).
|
||||
//
|
||||
// VCC (Virtual Color Computer) is free software: you can redistribute itand/or
|
||||
// modify it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// VCC (Virtual Color Computer) is distributed in the hope that it will be
|
||||
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
// Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along with
|
||||
// VCC (Virtual Color Computer). If not, see <http://www.gnu.org/licenses/>.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
#include "multipak_supervisor.h"
|
||||
#include "multipak_configuration.h"
|
||||
#include <Windows.h>
|
||||
|
||||
class configuration_dialog
|
||||
{
|
||||
public:
|
||||
|
||||
configuration_dialog(
|
||||
multipak_configuration& configuration,
|
||||
multipak_supervisor& mpi);
|
||||
|
||||
configuration_dialog(const configuration_dialog&) = delete;
|
||||
configuration_dialog(configuration_dialog&&) = delete;
|
||||
|
||||
configuration_dialog& operator=(const configuration_dialog&) = delete;
|
||||
configuration_dialog& operator=(configuration_dialog&&) = delete;
|
||||
|
||||
void open();
|
||||
void close();
|
||||
|
||||
private:
|
||||
|
||||
void select_new_cartridge(unsigned int item);
|
||||
void set_selected_slot(size_t slot);
|
||||
void update_slot_details(size_t slot);
|
||||
void eject_or_select_new_cartridge(unsigned int button);
|
||||
void cart_type_menu(unsigned int button);
|
||||
|
||||
static INT_PTR CALLBACK callback_procedure(
|
||||
HWND hDlg,
|
||||
UINT message,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam);
|
||||
|
||||
INT_PTR process_message(
|
||||
HWND hDlg,
|
||||
UINT message,
|
||||
WPARAM wParam);
|
||||
|
||||
private:
|
||||
|
||||
size_t slot_to_load_;
|
||||
multipak_configuration& configuration_;
|
||||
multipak_supervisor& mpi_;
|
||||
HWND dialog_handle_ = nullptr;
|
||||
HWND parent_handle_ = nullptr;
|
||||
};
|
||||
@@ -0,0 +1,118 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright 2015 by Joseph Forgione
|
||||
// This file is part of VCC (Virtual Color Computer).
|
||||
//
|
||||
// This is an expansion module for the Vcc Emulator. It simulated the functions
|
||||
// of the TRS-80 Multi-Pak Interface.
|
||||
//
|
||||
// VCC (Virtual Color Computer) is free software: you can redistribute itand/or
|
||||
// modify it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// VCC (Virtual Color Computer) is distributed in the hope that it will be
|
||||
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
// Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along with
|
||||
// VCC (Virtual Color Computer). If not, see <http://www.gnu.org/licenses/>.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "mpi.h"
|
||||
#include "resource.h"
|
||||
#include <vcc/util/DialogOps.h>
|
||||
#include <vcc/util/limits.h>
|
||||
#include <vcc/util/logger.h>
|
||||
#include <vcc/bus/cartridge_menuitem.h>
|
||||
#include <vcc/bus/cartridge_messages.h>
|
||||
|
||||
HINSTANCE gModuleInstance = nullptr;
|
||||
static std::string gConfigurationFilename;
|
||||
HWND gVccWnd;
|
||||
|
||||
slot_id_type SlotId = 0;
|
||||
|
||||
multipak_configuration gMultiPakConfiguration("MPI");
|
||||
multipak_supervisor gMultiPakInterface(gMultiPakConfiguration);
|
||||
|
||||
// the config dialog
|
||||
configuration_dialog gConfigurationDialog(gMultiPakConfiguration, gMultiPakInterface);
|
||||
|
||||
// DLL exports
|
||||
extern "C"
|
||||
{
|
||||
__declspec(dllexport) const char* PakGetName()
|
||||
{
|
||||
static char string_buffer[MAX_LOADSTRING];
|
||||
LoadString(gModuleInstance, IDS_MODULE_NAME, string_buffer, MAX_LOADSTRING);
|
||||
return string_buffer;
|
||||
}
|
||||
|
||||
__declspec(dllexport) const char* PakGetCatalogId()
|
||||
{
|
||||
static char string_buffer[MAX_LOADSTRING];
|
||||
LoadString(gModuleInstance, IDS_CATNUMBER, string_buffer, MAX_LOADSTRING);
|
||||
return string_buffer;
|
||||
}
|
||||
|
||||
//Initialize MPI - capture callback addresses and build menus.
|
||||
__declspec(dllexport) void PakInitialize(
|
||||
slot_id_type SlotId,
|
||||
const char* const configuration_path,
|
||||
HWND hVccWnd,
|
||||
const cpak_callbacks* const callbacks)
|
||||
{
|
||||
//Prevent MPI load in a multipak slot
|
||||
//TODO: enum for VCC error codes
|
||||
if (SlotId != 0) {
|
||||
int32_t err = 1;
|
||||
SendFatalError(hVccWnd, err);
|
||||
return;
|
||||
}
|
||||
|
||||
gMultiPakConfiguration.configuration_path(configuration_path);
|
||||
gConfigurationFilename = configuration_path;
|
||||
gVccWnd = hVccWnd;
|
||||
gMultiPakInterface.start();
|
||||
}
|
||||
|
||||
__declspec(dllexport) void PakTerminate()
|
||||
{
|
||||
gConfigurationDialog.close();
|
||||
gMultiPakInterface.stop();
|
||||
}
|
||||
|
||||
__declspec(dllexport) void PakMenuItemClicked(unsigned char menu_item_id)
|
||||
{
|
||||
gMultiPakInterface.menu_item_clicked(menu_item_id);
|
||||
}
|
||||
|
||||
// Fetch menu item list for MPI and carts it has loaded
|
||||
__declspec(dllexport) bool PakGetMenuItem(menu_item_entry* item, size_t index)
|
||||
{
|
||||
return gMultiPakInterface.get_menu_item(item, index);
|
||||
}
|
||||
|
||||
// Reset module
|
||||
__declspec(dllexport) unsigned char PakReset()
|
||||
{
|
||||
gMultiPakInterface.reset();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// DLLMain
|
||||
BOOL WINAPI DllMain(HINSTANCE module_instance, DWORD reason, LPVOID /*reserved*/)
|
||||
{
|
||||
switch (reason) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
gModuleInstance = module_instance;
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
PakTerminate();
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright 2015 by Joseph Forgione
|
||||
// This file is part of VCC (Virtual Color Computer).
|
||||
//
|
||||
// VCC (Virtual Color Computer) is free software: you can redistribute itand/or
|
||||
// modify it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// VCC (Virtual Color Computer) is distributed in the hope that it will be
|
||||
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
// Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along with
|
||||
// VCC (Virtual Color Computer). If not, see <http://www.gnu.org/licenses/>.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#include "configuration_dialog.h"
|
||||
#include <Windows.h>
|
||||
|
||||
extern HWND gVccWnd;
|
||||
extern configuration_dialog gConfigurationDialog;
|
||||
extern std::string gLastAccessedPath;
|
||||
@@ -0,0 +1,201 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "winres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (United States) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""winres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_DIALOG1 DIALOGEX 0, 0, 300, 165
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Multi-Pak Interface 2.1.9.3"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x1
|
||||
BEGIN
|
||||
GROUPBOX "Slot 4",IDC_STATIC, 5, 0 +4,166,28, BS_CENTER
|
||||
RADIOBUTTON "",IDC_SELECT4, 10, 0+15, 10,12
|
||||
CTEXT "",IDC_EDIT4, 22, 0+13,120,14, SS_CENTERIMAGE,WS_EX_CLIENTEDGE
|
||||
PUSHBUTTON ">",IDC_INSERT4, 148, 0+13, 14,14
|
||||
|
||||
GROUPBOX "Slot 3",IDC_STATIC, 5,30 +4,166,28, BS_CENTER
|
||||
RADIOBUTTON "",IDC_SELECT3, 10,30+15, 10,12
|
||||
CTEXT "",IDC_EDIT3, 22,30+13,120,14, SS_CENTERIMAGE,WS_EX_CLIENTEDGE
|
||||
PUSHBUTTON ">",IDC_INSERT3, 148,30+13, 14,14
|
||||
|
||||
GROUPBOX "Slot 2",IDC_STATIC, 5,60 +4,166,28, BS_CENTER
|
||||
RADIOBUTTON "",IDC_SELECT2, 10,60+15, 10,12
|
||||
CTEXT "",IDC_EDIT2, 22,60+13,120,14, SS_CENTERIMAGE,WS_EX_CLIENTEDGE
|
||||
PUSHBUTTON ">",IDC_INSERT2, 148,60+13, 14,14
|
||||
|
||||
GROUPBOX "Slot 1",IDC_STATIC, 5,90 +4,166,28, BS_CENTER
|
||||
RADIOBUTTON "",IDC_SELECT1, 10,90+15, 10,12
|
||||
CTEXT "",IDC_EDIT1, 22,90+13,120,14, SS_CENTERIMAGE,WS_EX_CLIENTEDGE
|
||||
PUSHBUTTON ">",IDC_INSERT1, 148,90+13, 14,14
|
||||
|
||||
EDITTEXT IDC_MODINFO, 175,8,118,115, ES_MULTILINE|ES_READONLY|ES_WANTRETURN
|
||||
|
||||
LTEXT "^ Radio button selects startup slot.", IDC_STATIC, 11,128,115,10
|
||||
LTEXT "^ X Eject cartridge.", IDC_STATIC, 152,128,66,10
|
||||
LTEXT "> Load cartridge.", IDC_STATIC, 222,128,60,10
|
||||
|
||||
PUSHBUTTON "Reset VCC",IDC_RESET, 6,142,55,15
|
||||
LTEXT "Reset VCC for startup slot change to take effect", IDC_STATIC, 68,145,230,10
|
||||
|
||||
DEFPUSHBUTTON "OK",IDOK, 240,142,50,15
|
||||
|
||||
// CHECKBOX "Persistent ProgramPak Images",IDC_PERSIST_PAK, 15,165,110,10
|
||||
// CHECKBOX "Disable Cart Select Signal",IDC_SCS_DISABLE, 140,165,100,10
|
||||
END
|
||||
|
||||
IDD_POPUP_MENU MENU
|
||||
BEGIN
|
||||
POPUP "select"
|
||||
BEGIN
|
||||
MENUITEM "Load DLL", IDC_LOAD_DLL
|
||||
MENUITEM "Load ROM", IDC_LOAD_ROM
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO
|
||||
BEGIN
|
||||
IDD_DIALOG1, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 6
|
||||
RIGHTMARGIN, 311
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 183
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 2,1,9,3
|
||||
PRODUCTVERSION 2,1,9,3
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x21L
|
||||
#else
|
||||
FILEFLAGS 0x20L
|
||||
#endif
|
||||
FILEOS 0x40004L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "Comments", "Tandy Multi-Pak Interface"
|
||||
VALUE "CompanyName", "BitRot Software"
|
||||
VALUE "FileDescription", "mpi"
|
||||
VALUE "FileVersion", "2.1.9.3"
|
||||
VALUE "InternalName", "MultiPak Interface"
|
||||
VALUE "LegalCopyright", "Copyright � 2007"
|
||||
VALUE "OriginalFilename", "mpi.dll"
|
||||
VALUE "ProductName", "mpi"
|
||||
VALUE "ProductVersion", "2.1.9.3"
|
||||
VALUE "SpecialBuild", "Tandy Multi-Pak Interface"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// AFX_DIALOG_LAYOUT
|
||||
//
|
||||
|
||||
IDD_DIALOG1 AFX_DIALOG_LAYOUT
|
||||
BEGIN
|
||||
0
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_MODULE_NAME "MPI"
|
||||
IDS_CATNUMBER "26-3124"
|
||||
IDS_VERISON "1.301"
|
||||
IDS_DESCRIPTION "Multipak Interface"
|
||||
END
|
||||
|
||||
#endif // English (United States) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Legacy|Win32">
|
||||
<Configuration>Legacy</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<SccProjectName />
|
||||
<SccLocalPath />
|
||||
<ProjectGuid>{678097F4-F33B-4739-B3E1-7A72BD1F4A3A}</ProjectGuid>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Legacy|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v141_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\vcc-base.props" />
|
||||
<Import Project="..\vcc-debug.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Legacy|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\vcc-base.props" />
|
||||
<Import Project="..\vcc-legacy.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\vcc-base.props" />
|
||||
<Import Project="..\vcc-release.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Legacy|Win32'">
|
||||
<LibraryPath>C:\Program Files %28x86%29\Windows Kits\8.1\Lib\winv6.3\um\x86;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Legacy|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;_USRDLL;MPI_EXPORTS;_LEGACY_VCC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalOptions>/arch:SSE</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0409</Culture>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<LinkDLL>true</LinkDLL>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;MPI_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalOptions>/arch:SSE</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<ResourceCompile />
|
||||
<Link>
|
||||
<LinkDLL>true</LinkDLL>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;MPI_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ResourceCompile />
|
||||
<Link>
|
||||
<LinkDLL>true</LinkDLL>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="mpi.cpp" />
|
||||
<ClCompile Include="multipak_supervisor.cpp" />
|
||||
<ClCompile Include="configuration_dialog.cpp" />
|
||||
<ClCompile Include="multipak_configuration.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="mpi.h" />
|
||||
<ClInclude Include="multipak_supervisor.h" />
|
||||
<ClInclude Include="multipak_configuration.h" />
|
||||
<ClInclude Include="configuration_dialog.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="mpi.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\libcommon\libcommon.vcxproj">
|
||||
<Project>{e0aa25bd-5527-475f-8d8b-b549a6311b0c}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,88 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright 2015 by Joseph Forgione
|
||||
// This file is part of VCC (Virtual Color Computer).
|
||||
//
|
||||
// This is an expansion module for the Vcc Emulator. It simulated the functions
|
||||
// of the TRS-80 Multi-Pak Interface.
|
||||
//
|
||||
// VCC (Virtual Color Computer) is free software: you can redistribute itand/or
|
||||
// modify it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// VCC (Virtual Color Computer) is distributed in the hope that it will be
|
||||
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
// Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along with
|
||||
// VCC (Virtual Color Computer). If not, see <http://www.gnu.org/licenses/>.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//-------------------------------------------------
|
||||
// Manage MPI configuration settings
|
||||
//-------------------------------------------------
|
||||
|
||||
#include "multipak_configuration.h"
|
||||
#include <vcc/util/settings.h>
|
||||
|
||||
using settings = ::VCC::Util::settings;
|
||||
|
||||
// Constructor sets the section
|
||||
multipak_configuration::multipak_configuration(std::string section)
|
||||
: section_(move(section))
|
||||
{}
|
||||
|
||||
// Set ini file path
|
||||
void multipak_configuration::configuration_path(std::string path)
|
||||
{
|
||||
configuration_path_ = move(path);
|
||||
}
|
||||
|
||||
// Return ini file path
|
||||
std::string multipak_configuration::configuration_path() const
|
||||
{
|
||||
return configuration_path_;
|
||||
}
|
||||
|
||||
// last rom path
|
||||
void multipak_configuration::last_accessed_rom_path(const std::string& path) const
|
||||
{
|
||||
settings(configuration_path()).write("DefaultPaths", "RomPath", path);
|
||||
}
|
||||
std::string multipak_configuration::last_accessed_rom_path() const
|
||||
{
|
||||
return settings(configuration_path()).read("DefaultPaths", "RomPath");
|
||||
}
|
||||
|
||||
// last dll path
|
||||
void multipak_configuration::last_accessed_dll_path(const std::string& path) const
|
||||
{
|
||||
settings(configuration_path()).write("DefaultPaths", "DLLPath", path);
|
||||
}
|
||||
std::string multipak_configuration::last_accessed_dll_path() const
|
||||
{
|
||||
return settings(configuration_path()).read("DefaultPaths", "DLLPath");
|
||||
}
|
||||
|
||||
void multipak_configuration::selected_slot(std::size_t slot) const
|
||||
{
|
||||
settings(configuration_path()).write(section_, "SWPOSITION", slot);
|
||||
}
|
||||
std::size_t multipak_configuration::selected_slot() const
|
||||
{
|
||||
return settings(configuration_path()).read(section_, "SWPOSITION", 3);
|
||||
}
|
||||
|
||||
// slot path
|
||||
void multipak_configuration::slot_cartridge_path(std::size_t slot, const std::string& path) const
|
||||
{
|
||||
std::string key="SLOT" + std::to_string(slot+1);
|
||||
settings(configuration_path()).write(section_, key, path);
|
||||
}
|
||||
std::string multipak_configuration::slot_cartridge_path(std::size_t slot) const
|
||||
{
|
||||
std::string key="SLOT" + std::to_string(slot+1);
|
||||
return settings(configuration_path()).read(section_, key);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright 2015 by Joseph Forgione
|
||||
// This file is part of VCC (Virtual Color Computer).
|
||||
//
|
||||
// This is an expansion module for the Vcc Emulator. It simulated the functions
|
||||
// of the TRS-80 Multi-Pak Interface.
|
||||
//
|
||||
// VCC (Virtual Color Computer) is free software: you can redistribute itand/or
|
||||
// modify it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// VCC (Virtual Color Computer) is distributed in the hope that it will be
|
||||
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
// Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along with
|
||||
// VCC (Virtual Color Computer). If not, see <http://www.gnu.org/licenses/>.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
class multipak_configuration
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
explicit multipak_configuration(std::string section);
|
||||
|
||||
void configuration_path(std::string path);
|
||||
std::string configuration_path() const;
|
||||
|
||||
std::string last_accessed_module_type() const;
|
||||
|
||||
void last_accessed_rom_path(const std::string& path) const;
|
||||
std::string last_accessed_rom_path() const;
|
||||
|
||||
void last_accessed_dll_path(const std::string& path) const;
|
||||
std::string last_accessed_dll_path() const;
|
||||
|
||||
void selected_slot(std::size_t slot) const;
|
||||
std::size_t selected_slot() const;
|
||||
|
||||
void slot_cartridge_path(std::size_t slot, const std::string& path) const;
|
||||
std::string slot_cartridge_path(std::size_t slot) const;
|
||||
|
||||
private:
|
||||
|
||||
const std::string section_;
|
||||
std::string configuration_path_;
|
||||
};
|
||||
@@ -0,0 +1,129 @@
|
||||
//#define USE_LOGGING
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright 2015 by Joseph Forgione
|
||||
// This file is part of VCC (Virtual Color Computer).
|
||||
//
|
||||
// VCC (Virtual Color Computer) is free software: you can redistribute itand/or
|
||||
// modify it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// VCC (Virtual Color Computer) is distributed in the hope that it will be
|
||||
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
// Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along with
|
||||
// VCC (Virtual Color Computer). If not, see <http://www.gnu.org/licenses/>.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "multipak_supervisor.h"
|
||||
#include "mpi.h"
|
||||
#include "resource.h"
|
||||
#include <vcc/util/coreutil.h>
|
||||
#include <vcc/util/textutil.h>
|
||||
#include <vcc/util/filesystem.h>
|
||||
#include <vcc/util/logger.h>
|
||||
#include <vcc/bus/cartridge_menu.h>
|
||||
#include <vcc/bus/cartridge_menuitem.h>
|
||||
#include <vcc/bus/cartridge_messages.h>
|
||||
|
||||
// SlotId is an unsigned int 0-4 used to indicate to a cartridge which slot
|
||||
// it is in. SlotId 0 is the boot slot, SlotId's 1-4 are multipak slots
|
||||
// mpi_slot indexes used elsewhere in this source differ, they represent only
|
||||
// multipak mpi_slots and are numbered 0-3, (SlotId = mpi_slot+1)
|
||||
|
||||
multipak_supervisor::multipak_supervisor(
|
||||
multipak_configuration& configuration)
|
||||
:
|
||||
configuration_(configuration) {}
|
||||
|
||||
void multipak_supervisor::start()
|
||||
{
|
||||
// Mount mpi slots per settings mpi_slit is 0-3, Slot is 1-4
|
||||
// Slot 0 is the the boot slot (where MPI cart is)
|
||||
for (int mpi_slot = 0; mpi_slot < 4; mpi_slot++)
|
||||
{
|
||||
const auto path(VCC::Util::find_pak_module_path(
|
||||
configuration_.slot_cartridge_path(mpi_slot)));
|
||||
if (!path.empty())
|
||||
{
|
||||
DLOG_C("\nmultipak_supervisor.start slot:%d %s\n",mpi_slot+1,path.c_str());
|
||||
CartLoadRequest slotData{};
|
||||
strcpy_s(slotData.pluginPath, slotData.size, path.c_str());
|
||||
SendLoadSlot(gVccWnd, mpi_slot+1, slotData);
|
||||
}
|
||||
}
|
||||
switch_slot_ = configuration_.selected_slot();
|
||||
SendActiveSlot(gVccWnd, switch_slot_);
|
||||
SendMessage(gVccWnd,WM_VCC_UPD_MENU,(WPARAM) 0,(LPARAM) 0);
|
||||
}
|
||||
|
||||
void multipak_supervisor::stop()
|
||||
{
|
||||
DLOG_C("multipak_supervisor stop\n");
|
||||
gConfigurationDialog.close();
|
||||
}
|
||||
|
||||
void multipak_supervisor::reset()
|
||||
{
|
||||
DLOG_C("multipak_supervisor reset\n");
|
||||
|
||||
VCC::Util::section_locker lock(mutex_);
|
||||
|
||||
unsigned char mpi_slot = switch_slot_ & 3;
|
||||
switch_slot_ = mpi_slot;
|
||||
|
||||
// Tell pakinterface what the active slot is
|
||||
SendActiveSlot(gVccWnd, switch_slot_); //0-3
|
||||
}
|
||||
|
||||
void multipak_supervisor::menu_item_clicked(unsigned char menu_item_id)
|
||||
{
|
||||
DLOG_C("multipak_supervisor menu_item_clicked %d\n", menu_item_id);
|
||||
|
||||
if (menu_item_id == 19) //MPI Config
|
||||
{
|
||||
gConfigurationDialog.open();
|
||||
}
|
||||
}
|
||||
|
||||
// Return MPI menu
|
||||
bool multipak_supervisor::get_menu_item(menu_item_entry* item, size_t index)
|
||||
{
|
||||
using VCC::Bus::gDllCartMenu;
|
||||
if (!item) return false;
|
||||
if (index == 0) {
|
||||
gDllCartMenu.clear();
|
||||
gDllCartMenu.add("", 0, MIT_Seperator);
|
||||
gDllCartMenu.add("MPI Config", ControlId(19), MIT_StandAlone);
|
||||
}
|
||||
return gDllCartMenu.copy_item( *item, index);
|
||||
}
|
||||
|
||||
// Send load cartridge request to pakinterface
|
||||
multipak_supervisor::mount_status_type multipak_supervisor::mount_cartridge(
|
||||
slot_id_type mpi_slot, const path_type& filename)
|
||||
{
|
||||
CartLoadRequest slotData{};
|
||||
strcpy_s(slotData.pluginPath, slotData.size, filename.c_str());
|
||||
SendLoadSlot(gVccWnd, mpi_slot+1, slotData); // Slot is 1-4
|
||||
|
||||
// Dynamic menu update
|
||||
SendMessage(gVccWnd,WM_VCC_UPD_MENU,(WPARAM) 0,(LPARAM) 0);
|
||||
|
||||
return mount_status_type::success;
|
||||
}
|
||||
|
||||
void multipak_supervisor::switch_to_slot(slot_id_type mpi_slot)
|
||||
{
|
||||
DLOG_C("multipak_supervisor set selected switch slot (0-3) %d\n", mpi_slot);
|
||||
switch_slot_ = mpi_slot;
|
||||
}
|
||||
|
||||
multipak_supervisor::slot_id_type multipak_supervisor::selected_switch_slot() const
|
||||
{
|
||||
DLOG_C("multipak_supervisor get selected switch slot %d\n", switch_slot_);
|
||||
return switch_slot_;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright 2015 by Joseph Forgione
|
||||
// This file is part of VCC (Virtual Color Computer).
|
||||
//
|
||||
// VCC (Virtual Color Computer) is free software: you can redistribute itand/or
|
||||
// modify it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// VCC (Virtual Color Computer) is distributed in the hope that it will be
|
||||
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
// Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along with
|
||||
// VCC (Virtual Color Computer). If not, see <http://www.gnu.org/licenses/>.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
#include "multipak_configuration.h"
|
||||
#include <vcc/bus/basic_cartridge.h>
|
||||
#include <vcc/bus/cartridge_loader.h>
|
||||
#include <vcc/bus/cartridge_menuitem.h>
|
||||
#include <vcc/util/critical_section.h>
|
||||
|
||||
constexpr size_t NUMSLOTS = 4u;
|
||||
|
||||
class multipak_supervisor
|
||||
{
|
||||
public:
|
||||
|
||||
using callbacks_type = ::VCC::Core::cartridge_callbacks;
|
||||
using mount_status_type = ::VCC::Core::cartridge_loader_status;
|
||||
|
||||
// TODO someday replace these stupid type defs with size_t and string
|
||||
using slot_id_type = std::size_t;
|
||||
using path_type = std::string;
|
||||
using label_type = std::string;
|
||||
using description_type = std::string;
|
||||
|
||||
public:
|
||||
|
||||
multipak_supervisor( multipak_configuration& configuration );
|
||||
|
||||
multipak_supervisor(const multipak_supervisor&) = delete;
|
||||
multipak_supervisor(multipak_supervisor&&) = delete;
|
||||
|
||||
multipak_supervisor& operator=(const multipak_supervisor&) = delete;
|
||||
multipak_supervisor& operator=(multipak_supervisor&&) = delete;
|
||||
|
||||
void start();
|
||||
void stop();
|
||||
void reset();
|
||||
void menu_item_clicked(unsigned char menu_item_id);
|
||||
bool get_menu_item(menu_item_entry* item, size_t index);
|
||||
|
||||
bool empty(slot_id_type slot) const;
|
||||
|
||||
mount_status_type mount_cartridge(slot_id_type slot, const path_type& filename);
|
||||
|
||||
void switch_to_slot(slot_id_type slot);
|
||||
slot_id_type selected_switch_slot() const;
|
||||
|
||||
private:
|
||||
|
||||
static const size_t default_switch_slot_value = 0x03;
|
||||
|
||||
VCC::Util::critical_section mutex_;
|
||||
multipak_configuration& configuration_;
|
||||
slot_id_type switch_slot_ = default_switch_slot_value;
|
||||
};
|
||||
@@ -0,0 +1,47 @@
|
||||
// Used by mpi.rc
|
||||
//
|
||||
#define IDS_MODULE_NAME 1
|
||||
#define IDS_CATNUMBER 2
|
||||
#define IDS_VERISON 3
|
||||
#define IDS_DESCRIPTION 4
|
||||
|
||||
#define IDD_DIALOG1 101
|
||||
#define IDD_POPUP_MENU 102
|
||||
|
||||
#define IDC_PAKSELECT 1000
|
||||
|
||||
#define IDC_EDIT1 1001
|
||||
#define IDC_EDIT2 1002
|
||||
#define IDC_EDIT3 1003
|
||||
#define IDC_EDIT4 1004
|
||||
|
||||
#define IDC_SELECT1 1011
|
||||
#define IDC_SELECT2 1012
|
||||
#define IDC_SELECT3 1013
|
||||
#define IDC_SELECT4 1014
|
||||
|
||||
#define IDC_INSERT1 1021
|
||||
#define IDC_INSERT2 1022
|
||||
#define IDC_INSERT3 1023
|
||||
#define IDC_INSERT4 1024
|
||||
|
||||
// Don't change order of the next two
|
||||
#define IDC_LOAD_DLL 1031
|
||||
#define IDC_LOAD_ROM 1032
|
||||
|
||||
#define IDC_MODINFO 1100
|
||||
#define IDC_PERSIST_PAK 1101
|
||||
#define IDC_SCS_DISABLE 1102
|
||||
#define IDC_RESET 1103
|
||||
|
||||
extern HINSTANCE gModuleInstance;
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 103
|
||||
#define _APS_NEXT_COMMAND_VALUE 40006
|
||||
#define _APS_NEXT_CONTROL_VALUE 1105
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
Reference in new issue
Block a user