Merge pull request #733 from windwakr/hcv1000

Slot2: Add Sega Card Reader(HCV-1000)
This commit is contained in:
zeromus 2023-10-04 20:04:39 -04:00 committed by GitHub
commit f3dee5d7ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 229 additions and 12 deletions

View File

@ -95,6 +95,7 @@ libdesmume_a_SOURCES = \
addons/slot2_none.cpp \ addons/slot2_none.cpp \
addons/slot2_rumblepak.cpp \ addons/slot2_rumblepak.cpp \
addons/slot2_guitarGrip.cpp \ addons/slot2_guitarGrip.cpp \
addons/slot2_hcv1000.cpp \
addons/slot2_expMemory.cpp \ addons/slot2_expMemory.cpp \
addons/slot2_piano.cpp \ addons/slot2_piano.cpp \
addons/slot2_passme.cpp \ addons/slot2_passme.cpp \

View File

@ -0,0 +1,81 @@
//HCV-1000 emulation code adapted from GBE+: https://github.com/shonumi/gbe-plus
/*
Modifications Copyright (C) 2023 DeSmuME team
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This file 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 the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
#include "../slot2.h"
u8 hcv1000_cnt;
char hcv1000_data[16];
class Slot2_HCV1000 : public ISlot2Interface
{
public:
virtual Slot2Info const* info()
{
static Slot2InfoSimple info("Sega Card Reader", "Sega Card Reader(HCV-1000) add-on", 0x09);
return &info;
}
virtual bool init()
{
hcv1000_cnt = 0;
memset(hcv1000_data, 0x5F, 16);
return TRUE;
}
virtual void writeByte(u8 PROCNUM, u32 addr, u8 val)
{
if (addr == 0xA000000) { hcv1000_cnt = (val & 0x83); }
}
virtual u8 readByte(u8 PROCNUM, u32 addr)
{
u8 slot_byte = 0xFF;
//Reading these cart addresses is for detection
if (addr < 0x8020000)
{
u8 data = 0xF0 | ((addr & 0x1F) >> 1);
slot_byte = (addr & 0x1) ? 0xFD : data;
}
//HCV_CNT
else if (addr == 0xA000000) { slot_byte = hcv1000_cnt; }
//HCV_DATA
else if ((addr >= 0xA000010) && (addr <= 0xA00001F))
{
slot_byte = (u8)hcv1000_data[addr & 0xF];
}
return slot_byte;
}
virtual u16 readWord(u8 PROCNUM, u32 addr) { return 0xFDFD; };
virtual u32 readLong(u8 PROCNUM, u32 addr) { return 0xFDFDFDFD; };
};
ISlot2Interface* construct_Slot2_HCV1000() { return new Slot2_HCV1000(); }
void HCV1000_setReady()
{
hcv1000_cnt &= ~0x80;
}

View File

@ -109,7 +109,7 @@ libdesmume_src += [
'../../utils/tinyxml/tinyxmlerror.cpp', '../../utils/tinyxml/tinyxmlerror.cpp',
'../../utils/tinyxml/tinyxmlparser.cpp', '../../utils/tinyxml/tinyxmlparser.cpp',
'../../utils/colorspacehandler/colorspacehandler.cpp', '../../utils/colorspacehandler/colorspacehandler.cpp',
'../../addons/slot2_auto.cpp', '../../addons/slot2_mpcf.cpp', '../../addons/slot2_paddle.cpp', '../../addons/slot2_gbagame.cpp', '../../addons/slot2_none.cpp', '../../addons/slot2_rumblepak.cpp', '../../addons/slot2_guitarGrip.cpp', '../../addons/slot2_expMemory.cpp', '../../addons/slot2_piano.cpp', '../../addons/slot2_passme.cpp', '../../addons/slot1_none.cpp', '../../addons/slot1_r4.cpp', '../../addons/slot1_retail_nand.cpp', '../../addons/slot1_retail_auto.cpp', '../../addons/slot1_retail_mcrom.cpp', '../../addons/slot1_retail_mcrom_debug.cpp', '../../addons/slot1comp_mc.cpp', '../../addons/slot1comp_rom.cpp', '../../addons/slot1comp_protocol.cpp', '../../addons/slot2_auto.cpp', '../../addons/slot2_mpcf.cpp', '../../addons/slot2_paddle.cpp', '../../addons/slot2_gbagame.cpp', '../../addons/slot2_none.cpp', '../../addons/slot2_rumblepak.cpp', '../../addons/slot2_guitarGrip.cpp', '../../addons/slot2_hcv1000.cpp', '../../addons/slot2_expMemory.cpp', '../../addons/slot2_piano.cpp', '../../addons/slot2_passme.cpp', '../../addons/slot1_none.cpp', '../../addons/slot1_r4.cpp', '../../addons/slot1_retail_nand.cpp', '../../addons/slot1_retail_auto.cpp', '../../addons/slot1_retail_mcrom.cpp', '../../addons/slot1_retail_mcrom_debug.cpp', '../../addons/slot1comp_mc.cpp', '../../addons/slot1comp_rom.cpp', '../../addons/slot1comp_protocol.cpp',
'../../cheatSystem.cpp', '../../cheatSystem.cpp',
'../../texcache.cpp', '../../rasterize.cpp', '../../texcache.cpp', '../../rasterize.cpp',
'../../metaspu/metaspu.cpp', '../../metaspu/metaspu.cpp',

View File

@ -268,6 +268,7 @@
<ClCompile Include="..\..\..\addons\slot2_expMemory.cpp" /> <ClCompile Include="..\..\..\addons\slot2_expMemory.cpp" />
<ClCompile Include="..\..\..\addons\slot2_gbagame.cpp" /> <ClCompile Include="..\..\..\addons\slot2_gbagame.cpp" />
<ClCompile Include="..\..\..\addons\slot2_guitarGrip.cpp" /> <ClCompile Include="..\..\..\addons\slot2_guitarGrip.cpp" />
<ClCompile Include="..\..\..\addons\slot2_hcv1000.cpp" />
<ClCompile Include="..\..\..\addons\slot2_none.cpp" /> <ClCompile Include="..\..\..\addons\slot2_none.cpp" />
<ClCompile Include="..\..\..\addons\slot2_rumblepak.cpp" /> <ClCompile Include="..\..\..\addons\slot2_rumblepak.cpp" />
<ClCompile Include="..\..\..\utils\guid.cpp" /> <ClCompile Include="..\..\..\utils\guid.cpp" />

View File

@ -132,6 +132,9 @@
<ClCompile Include="..\..\..\addons\slot2_guitarGrip.cpp"> <ClCompile Include="..\..\..\addons\slot2_guitarGrip.cpp">
<Filter>addons</Filter> <Filter>addons</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\..\addons\slot2_hcv1000.cpp">
<Filter>addons</Filter>
</ClCompile>
<ClCompile Include="..\..\..\addons\slot2_none.cpp"> <ClCompile Include="..\..\..\addons\slot2_none.cpp">
<Filter>addons</Filter> <Filter>addons</Filter>
</ClCompile> </ClCompile>

View File

@ -98,7 +98,7 @@ libdesmume_a_SOURCES = \
../../utils/tinyxml/tinyxmlparser.cpp \ ../../utils/tinyxml/tinyxmlparser.cpp \
../../utils/glcorearb.h \ ../../utils/glcorearb.h \
../../utils/colorspacehandler/colorspacehandler.cpp ../../utils/colorspacehandler/colorspacehandler.h \ ../../utils/colorspacehandler/colorspacehandler.cpp ../../utils/colorspacehandler/colorspacehandler.h \
../../addons/slot2_auto.cpp ../../addons/slot2_mpcf.cpp ../../addons/slot2_paddle.cpp ../../addons/slot2_gbagame.cpp ../../addons/slot2_none.cpp ../../addons/slot2_rumblepak.cpp ../../addons/slot2_guitarGrip.cpp ../../addons/slot2_expMemory.cpp ../../addons/slot2_piano.cpp ../../addons/slot2_passme.cpp ../../addons/slot1_none.cpp ../../addons/slot1_r4.cpp ../../addons/slot1_retail_nand.cpp ../../addons/slot1_retail_auto.cpp ../../addons/slot1_retail_mcrom.cpp ../../addons/slot1_retail_mcrom_debug.cpp ../../addons/slot1comp_mc.cpp ../../addons/slot1comp_mc.h ../../addons/slot1comp_rom.h ../../addons/slot1comp_rom.cpp ../../addons/slot1comp_protocol.h ../../addons/slot1comp_protocol.cpp \ ../../addons/slot2_auto.cpp ../../addons/slot2_mpcf.cpp ../../addons/slot2_paddle.cpp ../../addons/slot2_gbagame.cpp ../../addons/slot2_none.cpp ../../addons/slot2_rumblepak.cpp ../../addons/slot2_guitarGrip.cpp ../../addons/slot2_hcv1000.cpp ../../addons/slot2_expMemory.cpp ../../addons/slot2_piano.cpp ../../addons/slot2_passme.cpp ../../addons/slot1_none.cpp ../../addons/slot1_r4.cpp ../../addons/slot1_retail_nand.cpp ../../addons/slot1_retail_auto.cpp ../../addons/slot1_retail_mcrom.cpp ../../addons/slot1_retail_mcrom_debug.cpp ../../addons/slot1comp_mc.cpp ../../addons/slot1comp_mc.h ../../addons/slot1comp_rom.h ../../addons/slot1comp_rom.cpp ../../addons/slot1comp_protocol.h ../../addons/slot1comp_protocol.cpp \
../../cheatSystem.cpp ../../cheatSystem.h \ ../../cheatSystem.cpp ../../cheatSystem.h \
../../texcache.cpp ../../texcache.h ../../rasterize.cpp ../../rasterize.h \ ../../texcache.cpp ../../texcache.h ../../rasterize.cpp ../../rasterize.h \
../../metaspu/metaspu.cpp ../../metaspu/metaspu.h \ ../../metaspu/metaspu.cpp ../../metaspu/metaspu.h \

View File

@ -104,7 +104,7 @@ libdesmume_src = [
'../../utils/tinyxml/tinyxmlerror.cpp', '../../utils/tinyxml/tinyxmlerror.cpp',
'../../utils/tinyxml/tinyxmlparser.cpp', '../../utils/tinyxml/tinyxmlparser.cpp',
'../../utils/colorspacehandler/colorspacehandler.cpp', '../../utils/colorspacehandler/colorspacehandler.cpp',
'../../addons/slot2_auto.cpp', '../../addons/slot2_mpcf.cpp', '../../addons/slot2_paddle.cpp', '../../addons/slot2_gbagame.cpp', '../../addons/slot2_none.cpp', '../../addons/slot2_rumblepak.cpp', '../../addons/slot2_guitarGrip.cpp', '../../addons/slot2_expMemory.cpp', '../../addons/slot2_piano.cpp', '../../addons/slot2_passme.cpp', '../../addons/slot1_none.cpp', '../../addons/slot1_r4.cpp', '../../addons/slot1_retail_nand.cpp', '../../addons/slot1_retail_auto.cpp', '../../addons/slot1_retail_mcrom.cpp', '../../addons/slot1_retail_mcrom_debug.cpp', '../../addons/slot1comp_mc.cpp', '../../addons/slot1comp_rom.cpp', '../../addons/slot1comp_protocol.cpp', '../../addons/slot2_auto.cpp', '../../addons/slot2_mpcf.cpp', '../../addons/slot2_paddle.cpp', '../../addons/slot2_gbagame.cpp', '../../addons/slot2_none.cpp', '../../addons/slot2_rumblepak.cpp', '../../addons/slot2_guitarGrip.cpp', '../../addons/slot2_hcv1000.cpp', '../../addons/slot2_expMemory.cpp', '../../addons/slot2_piano.cpp', '../../addons/slot2_passme.cpp', '../../addons/slot1_none.cpp', '../../addons/slot1_r4.cpp', '../../addons/slot1_retail_nand.cpp', '../../addons/slot1_retail_auto.cpp', '../../addons/slot1_retail_mcrom.cpp', '../../addons/slot1_retail_mcrom_debug.cpp', '../../addons/slot1comp_mc.cpp', '../../addons/slot1comp_rom.cpp', '../../addons/slot1comp_protocol.cpp',
'../../cheatSystem.cpp', '../../cheatSystem.cpp',
'../../texcache.cpp', '../../rasterize.cpp', '../../texcache.cpp', '../../rasterize.cpp',
'../../metaspu/metaspu.cpp', '../../metaspu/metaspu.cpp',

View File

@ -65,6 +65,7 @@
<ClCompile Include="..\..\addons\slot1_retail_mcrom.cpp" /> <ClCompile Include="..\..\addons\slot1_retail_mcrom.cpp" />
<ClCompile Include="..\..\addons\slot1_retail_mcrom_debug.cpp" /> <ClCompile Include="..\..\addons\slot1_retail_mcrom_debug.cpp" />
<ClCompile Include="..\..\addons\slot2_auto.cpp" /> <ClCompile Include="..\..\addons\slot2_auto.cpp" />
<ClCompile Include="..\..\addons\slot2_hcv1000.cpp" />
<ClCompile Include="..\..\addons\slot2_passme.cpp" /> <ClCompile Include="..\..\addons\slot2_passme.cpp" />
<ClCompile Include="..\..\addons\slot2_piano.cpp" /> <ClCompile Include="..\..\addons\slot2_piano.cpp" />
<ClCompile Include="..\..\addons\slot1_none.cpp" /> <ClCompile Include="..\..\addons\slot1_none.cpp" />

View File

@ -930,6 +930,9 @@
<ClCompile Include="display.cpp"> <ClCompile Include="display.cpp">
<Filter>frontend\Windows</Filter> <Filter>frontend\Windows</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\addons\slot2_hcv1000.cpp">
<Filter>addons</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\..\utils\guid.h"> <ClInclude Include="..\..\utils\guid.h">

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2009-2016 DeSmuME team Copyright (C) 2009-2023 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -36,18 +36,21 @@ u8 last_type = 0;
char tmp_cflash_filename[MAX_PATH] = { 0 }; char tmp_cflash_filename[MAX_PATH] = { 0 };
char tmp_cflash_path[MAX_PATH] = { 0 }; char tmp_cflash_path[MAX_PATH] = { 0 };
char tmp_gbagame_filename[MAX_PATH] = { 0 }; char tmp_gbagame_filename[MAX_PATH] = { 0 };
TCHAR tmp_hcv1000_barcode[17] = { 0 };
ADDON_CFLASH_MODE tmp_CFlashMode = ADDON_CFLASH_MODE_RomPath; ADDON_CFLASH_MODE tmp_CFlashMode = ADDON_CFLASH_MODE_RomPath;
HWND OKbutton = NULL; HWND OKbutton = NULL;
bool _OKbutton = false; bool _OKbutton = false;
SGuitar tmp_Guitar; SGuitar tmp_Guitar;
SPiano tmp_Piano; SPiano tmp_Piano;
SPaddle tmp_Paddle; SPaddle tmp_Paddle;
SHCV1000 tmp_HCV1000;
//these are the remembered preset values for directory and filename //these are the remembered preset values for directory and filename
//they are named very verbosely to distinguish them from the currently-configured values in addons.cpp //they are named very verbosely to distinguish them from the currently-configured values in addons.cpp
std::string win32_CFlash_cfgDirectory, win32_CFlash_cfgFileName; std::string win32_CFlash_cfgDirectory, win32_CFlash_cfgFileName;
UINT win32_CFlash_cfgMode; UINT win32_CFlash_cfgMode;
std::string win32_GBA_cfgRomPath; std::string win32_GBA_cfgRomPath;
std::string win32_HCV1000_barcode;
INT_PTR CALLBACK GbaSlotNone(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam) INT_PTR CALLBACK GbaSlotNone(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
{ {
@ -263,6 +266,54 @@ INT_PTR CALLBACK GbaSlotPaddle(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam
return FALSE; return FALSE;
} }
INT_PTR CALLBACK GbaSlotHCV1000(HWND dialog, UINT msg, WPARAM wparam, LPARAM lparam)
{
int which = 0;
switch (msg)
{
case WM_INITDIALOG:
_OKbutton = TRUE;
SendDlgItemMessage(dialog, IDC_HCVSCAN, WM_USER + 44, tmp_HCV1000.SCANKEY, 0);
SendDlgItemMessage(dialog, IDC_HCVBARCODE, EM_SETLIMITTEXT, 16, 0);
SendDlgItemMessage(dialog, IDC_HCVBARCODE, EM_SETSEL, 0, 16);
SetWindowText(GetDlgItem(dialog, IDC_HCVBARCODE), tmp_hcv1000_barcode);
return TRUE;
case WM_USER + 46:
SendDlgItemMessage(dialog, IDC_HCVSCAN, WM_USER + 44, tmp_HCV1000.SCANKEY, 0);
return TRUE;
case WM_USER + 43:
//MessageBox(hDlg,"USER+43 CAUGHT","moo",MB_OK);
which = GetDlgCtrlID((HWND)lparam);
switch (which)
{
case IDC_HCVSCAN:
tmp_HCV1000.SCANKEY = wparam;
break;
}
SendDlgItemMessage(dialog, IDC_HCVSCAN, WM_USER + 44, tmp_HCV1000.SCANKEY, 0);
PostMessage(dialog, WM_NEXTDLGCTL, 0, 0);
return true;
case WM_COMMAND:
case EN_UPDATE:
switch (LOWORD(wparam))
{
case IDC_HCVBARCODE:
GetWindowText(GetDlgItem(dialog, IDC_HCVBARCODE), tmp_hcv1000_barcode, 16);
return FALSE;
}
break;
}
return FALSE;
}
INT_PTR CALLBACK GbaSlotRumblePak(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam) INT_PTR CALLBACK GbaSlotRumblePak(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
{ {
switch(msg) switch(msg)
@ -478,6 +529,7 @@ u32 GBAslot_IDDs[NDS_SLOT2_COUNT] = {
IDD_GBASLOT_PIANO, IDD_GBASLOT_PIANO,
IDD_GBASLOT_PADDLE, //paddle IDD_GBASLOT_PADDLE, //paddle
IDD_GBASLOT_NONE, //PassME IDD_GBASLOT_NONE, //PassME
IDD_GBASLOT_HCV1000, //HCV-1000
}; };
DLGPROC GBAslot_Procs[NDS_SLOT2_COUNT] = { DLGPROC GBAslot_Procs[NDS_SLOT2_COUNT] = {
@ -490,7 +542,8 @@ DLGPROC GBAslot_Procs[NDS_SLOT2_COUNT] = {
GbaSlotNone, //expmem GbaSlotNone, //expmem
GbaSlotPiano, GbaSlotPiano,
GbaSlotPaddle, GbaSlotPaddle,
GbaSlotNone // PassME GbaSlotNone, // PassME
GbaSlotHCV1000, //HCV-1000
}; };
@ -566,9 +619,11 @@ void GBAslotDialog(HWND hwnd)
strcpy(tmp_cflash_filename, win32_CFlash_cfgFileName.c_str()); strcpy(tmp_cflash_filename, win32_CFlash_cfgFileName.c_str());
strcpy(tmp_cflash_path, win32_CFlash_cfgDirectory.c_str()); strcpy(tmp_cflash_path, win32_CFlash_cfgDirectory.c_str());
strcpy(tmp_gbagame_filename, win32_GBA_cfgRomPath.c_str()); strcpy(tmp_gbagame_filename, win32_GBA_cfgRomPath.c_str());
strcpy(tmp_hcv1000_barcode, win32_HCV1000_barcode.c_str());
memcpy(&tmp_Guitar, &Guitar, sizeof(Guitar)); memcpy(&tmp_Guitar, &Guitar, sizeof(Guitar));
memcpy(&tmp_Piano, &Piano, sizeof(Piano)); memcpy(&tmp_Piano, &Piano, sizeof(Piano));
memcpy(&tmp_Paddle, &Paddle, sizeof(Paddle)); memcpy(&tmp_Paddle, &Paddle, sizeof(Paddle));
memcpy(&tmp_HCV1000, &HCV1000, sizeof(HCV1000));
tmp_CFlashMode = CFlash_Mode; tmp_CFlashMode = CFlash_Mode;
_OKbutton = false; _OKbutton = false;
@ -633,6 +688,14 @@ void GBAslotDialog(HWND hwnd)
break; break;
case NDS_SLOT2_PASSME: case NDS_SLOT2_PASSME:
break; break;
case NDS_SLOT2_HCV1000:
win32_HCV1000_barcode = tmp_hcv1000_barcode;
memcpy(&HCV1000, &tmp_HCV1000, sizeof(tmp_HCV1000));
memset(hcv1000_data, 0x5F, 16);
memcpy(hcv1000_data, win32_HCV1000_barcode.c_str(), (win32_HCV1000_barcode.length() <= 16) ? win32_HCV1000_barcode.length() : 16);
WritePrivateProfileString("Slot2.HCV1000", "barcode", tmp_hcv1000_barcode, IniName);
WritePrivateProfileInt("Slot2.HCV1000", "scankey", HCV1000.SCANKEY, IniName);
break;
default: default:
return; return;
} }
@ -644,6 +707,7 @@ void GBAslotDialog(HWND hwnd)
Guitar.Enabled = (slot2_GetCurrentType() == NDS_SLOT2_GUITARGRIP)?true:false; Guitar.Enabled = (slot2_GetCurrentType() == NDS_SLOT2_GUITARGRIP)?true:false;
Piano.Enabled = (slot2_GetCurrentType() == NDS_SLOT2_EASYPIANO)?true:false; Piano.Enabled = (slot2_GetCurrentType() == NDS_SLOT2_EASYPIANO)?true:false;
Paddle.Enabled = (slot2_GetCurrentType() == NDS_SLOT2_PADDLE)?true:false; Paddle.Enabled = (slot2_GetCurrentType() == NDS_SLOT2_PADDLE)?true:false;
HCV1000.Enabled = (slot2_GetCurrentType() == NDS_SLOT2_HCV1000)?true:false;
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2009-2015 DeSmuME team Copyright (C) 2009-2023 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -24,6 +24,7 @@
extern std::string win32_CFlash_cfgDirectory, win32_CFlash_cfgFileName; extern std::string win32_CFlash_cfgDirectory, win32_CFlash_cfgFileName;
extern UINT win32_CFlash_cfgMode; extern UINT win32_CFlash_cfgMode;
extern std::string win32_GBA_cfgRomPath; extern std::string win32_GBA_cfgRomPath;
extern std::string win32_HCV1000_barcode;
extern void GBAslotDialog(HWND hwnd); extern void GBAslotDialog(HWND hwnd);

View File

@ -3,7 +3,7 @@
licensed under the terms supplied at the end of this file (for the terms are very long!) licensed under the terms supplied at the end of this file (for the terms are very long!)
Differences from that baseline version are: Differences from that baseline version are:
Copyright (C) 2009-2019 DeSmuME team Copyright (C) 2009-2023 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -258,6 +258,9 @@ SPiano DefaultPiano = { false, 'Z', 'S', 'X', 'D', 'C', 'V', 'G', 'B', 'H', 'N',
SPaddle Paddle; SPaddle Paddle;
SPaddle DefaultPaddle = { false, 'K', 'L' }; SPaddle DefaultPaddle = { false, 'K', 'L' };
SHCV1000 HCV1000;
SHCV1000 DefaultHCV1000 = { false, 'L'};
bool killStylusTopScreen = false; bool killStylusTopScreen = false;
bool killStylusOffScreen = false; bool killStylusOffScreen = false;
bool allowUpAndDown = false; bool allowUpAndDown = false;
@ -390,6 +393,15 @@ static void ReadPaddleControl(const char* name, WORD& output)
} }
} }
static void ReadHCV1000Control(const char* name, WORD& output)
{
UINT temp;
temp = GetPrivateProfileInt("Slot2.HCV1000", name, -1, IniName);
if (temp != -1) {
output = temp;
}
}
void LoadHotkeyConfig() void LoadHotkeyConfig()
{ {
SCustomKey *key = &CustomKeys.key(0); SCustomKey *key = &CustomKeys.key(0);
@ -452,6 +464,15 @@ static void LoadPaddleConfig()
ReadPaddleControl("INC", Paddle.INC); ReadPaddleControl("INC", Paddle.INC);
} }
static void LoadHCV1000Config()
{
memcpy(&HCV1000, &DefaultHCV1000, sizeof(HCV1000));
#define DO(X) ReadHCV1000Control(#X,HCV1000.X);
DO(SCANKEY);
#undef DO
}
static void LoadInputConfig() static void LoadInputConfig()
{ {
@ -2690,6 +2711,7 @@ void input_init()
LoadGuitarConfig(); LoadGuitarConfig();
LoadPianoConfig(); LoadPianoConfig();
LoadPaddleConfig(); LoadPaddleConfig();
LoadHCV1000Config();
di_init(); di_init();
FeedbackON = input_feedback; FeedbackON = input_feedback;
@ -2816,6 +2838,12 @@ void input_acquire()
if (inc) nds.paddle += 5; if (inc) nds.paddle += 5;
if (dec) nds.paddle -= 5; if (dec) nds.paddle -= 5;
} }
if (HCV1000.Enabled)
{
bool scan = !S9xGetState(HCV1000.SCANKEY);
if (scan) HCV1000_setReady();
}
} }
else else
{ {

View File

@ -3,7 +3,7 @@
licensed under the terms supplied at the end of this file (for the terms are very long!) licensed under the terms supplied at the end of this file (for the terms are very long!)
Differences from that baseline version are: Differences from that baseline version are:
Copyright (C) 2008-2010 DeSmuME team Copyright (C) 2008-2023 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -153,9 +153,15 @@ struct SPaddle {
WORD INC; WORD INC;
}; };
struct SHCV1000 {
BOOL Enabled;
WORD SCANKEY;
};
extern SGuitar Guitar; extern SGuitar Guitar;
extern SPiano Piano; extern SPiano Piano;
extern SPaddle Paddle; extern SPaddle Paddle;
extern SHCV1000 HCV1000;
#endif #endif

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2006 Theo Berkau Copyright (C) 2006 Theo Berkau
Copyright (C) 2006-2019 DeSmuME team Copyright (C) 2006-2023 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -1580,6 +1580,7 @@ static BOOL LoadROM(const char * filename, const char * physicalName, const char
Guitar.Enabled = (selectedSlot2Type == NDS_SLOT2_GUITARGRIP)?true:false; Guitar.Enabled = (selectedSlot2Type == NDS_SLOT2_GUITARGRIP)?true:false;
Piano.Enabled = (selectedSlot2Type == NDS_SLOT2_EASYPIANO)?true:false; Piano.Enabled = (selectedSlot2Type == NDS_SLOT2_EASYPIANO)?true:false;
Paddle.Enabled = (selectedSlot2Type == NDS_SLOT2_PADDLE)?true:false; Paddle.Enabled = (selectedSlot2Type == NDS_SLOT2_PADDLE)?true:false;
HCV1000.Enabled = (selectedSlot2Type == NDS_SLOT2_HCV1000)?true:false;
LoadSaveStateInfo(); LoadSaveStateInfo();
lagframecounter=0; lagframecounter=0;
@ -2197,6 +2198,8 @@ int _main()
win32_CFlash_cfgDirectory = GetPrivateProfileStdString("Slot2.CFlash", "path", ""); win32_CFlash_cfgDirectory = GetPrivateProfileStdString("Slot2.CFlash", "path", "");
win32_CFlash_cfgFileName = GetPrivateProfileStdString("Slot2.CFlash", "filename", ""); win32_CFlash_cfgFileName = GetPrivateProfileStdString("Slot2.CFlash", "filename", "");
win32_GBA_cfgRomPath = GetPrivateProfileStdString("Slot2.GBAgame", "filename", ""); win32_GBA_cfgRomPath = GetPrivateProfileStdString("Slot2.GBAgame", "filename", "");
win32_HCV1000_barcode = GetPrivateProfileStdString("Slot2.HCV1000", "barcode", "");
memcpy(hcv1000_data, win32_HCV1000_barcode.c_str(), (win32_HCV1000_barcode.length() <= 16) ? win32_HCV1000_barcode.length() : 16);
cmdline.process_addonCommands(); cmdline.process_addonCommands();
WIN_InstallCFlash(); WIN_InstallCFlash();
@ -2258,6 +2261,8 @@ int _main()
break; break;
case NDS_SLOT2_PASSME: case NDS_SLOT2_PASSME:
break; break;
case NDS_SLOT2_HCV1000:
break;
default: default:
slot2_device_type = NDS_SLOT2_NONE; slot2_device_type = NDS_SLOT2_NONE;
break; break;
@ -2268,6 +2273,7 @@ int _main()
Guitar.Enabled = (slot2_device_type == NDS_SLOT2_GUITARGRIP)?true:false; Guitar.Enabled = (slot2_device_type == NDS_SLOT2_GUITARGRIP)?true:false;
Piano.Enabled = (slot2_device_type == NDS_SLOT2_EASYPIANO)?true:false; Piano.Enabled = (slot2_device_type == NDS_SLOT2_EASYPIANO)?true:false;
Paddle.Enabled = (slot2_device_type == NDS_SLOT2_PADDLE)?true:false; Paddle.Enabled = (slot2_device_type == NDS_SLOT2_PADDLE)?true:false;
HCV1000.Enabled = (slot2_device_type == NDS_SLOT2_HCV1000)?true:false;
CommonSettings.WifiBridgeDeviceID = GetPrivateProfileInt("Wifi", "BridgeAdapter", 0, IniName); CommonSettings.WifiBridgeDeviceID = GetPrivateProfileInt("Wifi", "BridgeAdapter", 0, IniName);

View File

@ -514,7 +514,9 @@
#define IDC_WIFI_ENABLED 1065 #define IDC_WIFI_ENABLED 1065
#define IDC_STATIC_RANGE 1066 #define IDC_STATIC_RANGE 1066
#define IDC_WIFI_COMPAT 1066 #define IDC_WIFI_COMPAT 1066
#define IDC_HCVSCAN 1066
#define IDC_TEXSCALE 1067 #define IDC_TEXSCALE 1067
#define IDC_HCVBARCODE 1067
#define IDC_BADD 1068 #define IDC_BADD 1068
#define IDC_LIST 1069 #define IDC_LIST 1069
#define IDC_TEX_DEPOSTERIZE 1070 #define IDC_TEX_DEPOSTERIZE 1070
@ -923,6 +925,7 @@
#define IDD_SLOT1_R4 10012 #define IDD_SLOT1_R4 10012
#define IDD_SLOT1_DEBUG 10013 #define IDD_SLOT1_DEBUG 10013
#define IDD_GBASLOT_PADDLE 10014 #define IDD_GBASLOT_PADDLE 10014
#define IDD_GBASLOT_HCV1000 10015
#define IDM_FILE_STOPAVI 40000 #define IDM_FILE_STOPAVI 40000
#define IDM_SCREENSEP_NONE 40000 #define IDM_SCREENSEP_NONE 40000
#define IDM_FILE_STOPWAV 40001 #define IDM_FILE_STOPWAV 40001
@ -1156,7 +1159,7 @@
#define _APS_NO_MFC 1 #define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 128 #define _APS_NEXT_RESOURCE_VALUE 128
#define _APS_NEXT_COMMAND_VALUE 40159 #define _APS_NEXT_COMMAND_VALUE 40159
#define _APS_NEXT_CONTROL_VALUE 1066 #define _APS_NEXT_CONTROL_VALUE 1068
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101
#endif #endif
#endif #endif

View File

@ -1591,6 +1591,17 @@ BEGIN
RTEXT "Decrease",-1,81,40,44,8 RTEXT "Decrease",-1,81,40,44,8
END END
IDD_GBASLOT_HCV1000 DIALOGEX 7, 48, 302, 109
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE | WS_SYSMENU
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
EDITTEXT IDC_HCVBARCODE,129,42,72,14,ES_AUTOHSCROLL
CONTROL " ",IDC_HCVSCAN,"InputCustomGuitar",WS_TABSTOP,129,24,71,12,WS_EX_CLIENTEDGE
RTEXT "Scan key",-1,80,27,46,8
LTEXT "Card reader",-1,137,8,53,15
RTEXT "Barcode",-1,79,46,46,8
END
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2009-2015 DeSmuME team Copyright (C) 2009-2023 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -58,6 +58,7 @@ void slot2_Init()
extern TISlot2InterfaceConstructor construct_Slot2_EasyPiano; extern TISlot2InterfaceConstructor construct_Slot2_EasyPiano;
extern TISlot2InterfaceConstructor construct_Slot2_Paddle; extern TISlot2InterfaceConstructor construct_Slot2_Paddle;
extern TISlot2InterfaceConstructor construct_Slot2_PassME; extern TISlot2InterfaceConstructor construct_Slot2_PassME;
extern TISlot2InterfaceConstructor construct_Slot2_HCV1000;
slot2_List[NDS_SLOT2_NONE] = construct_Slot2_None(); slot2_List[NDS_SLOT2_NONE] = construct_Slot2_None();
slot2_List[NDS_SLOT2_AUTO] = construct_Slot2_Auto(); slot2_List[NDS_SLOT2_AUTO] = construct_Slot2_Auto();
@ -69,6 +70,7 @@ void slot2_Init()
slot2_List[NDS_SLOT2_EASYPIANO] = construct_Slot2_EasyPiano(); slot2_List[NDS_SLOT2_EASYPIANO] = construct_Slot2_EasyPiano();
slot2_List[NDS_SLOT2_PADDLE] = construct_Slot2_Paddle(); slot2_List[NDS_SLOT2_PADDLE] = construct_Slot2_Paddle();
slot2_List[NDS_SLOT2_PASSME] = construct_Slot2_PassME(); slot2_List[NDS_SLOT2_PASSME] = construct_Slot2_PassME();
slot2_List[NDS_SLOT2_HCV1000] = construct_Slot2_HCV1000();
} }
@ -252,6 +254,9 @@ NDS_SLOT2_TYPE slot2_DetermineTypeByGameCode(const char *theGameCode)
{"CV8", NDS_SLOT2_PADDLE}, // Space Invaders Extreme 2 {"CV8", NDS_SLOT2_PADDLE}, // Space Invaders Extreme 2
{"AMH", NDS_SLOT2_RUMBLEPAK}, // Metroid Prime Hunters {"AMH", NDS_SLOT2_RUMBLEPAK}, // Metroid Prime Hunters
{"AP2", NDS_SLOT2_RUMBLEPAK}, // Metroid Prime Pinball {"AP2", NDS_SLOT2_RUMBLEPAK}, // Metroid Prime Pinball
{"C4A", NDS_SLOT2_HCV1000}, // Card de Asobu! Hajimete no DS
{"A6I", NDS_SLOT2_HCV1000}, // Kouchuu Ouja: Mushi King Super Collection
{"ALB", NDS_SLOT2_HCV1000}, // Oshare Majo Berry and Love
}; };
for(size_t i = 0; i < ARRAY_SIZE(gameCodeDeviceTypes); i++) for(size_t i = 0; i < ARRAY_SIZE(gameCodeDeviceTypes); i++)

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2009-2015 DeSmuME team Copyright (C) 2009-2023 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -97,6 +97,7 @@ enum NDS_SLOT2_TYPE
NDS_SLOT2_EASYPIANO, // 0x06 - Easy Piano NDS_SLOT2_EASYPIANO, // 0x06 - Easy Piano
NDS_SLOT2_PADDLE, // 0x07 - Arkanoids DS paddle NDS_SLOT2_PADDLE, // 0x07 - Arkanoids DS paddle
NDS_SLOT2_PASSME, // 0x08 - PassME/Homebrew NDS_SLOT2_PASSME, // 0x08 - PassME/Homebrew
NDS_SLOT2_HCV1000, // 0x09 - HCV-1000 Sega Card Reader
NDS_SLOT2_COUNT // use for counter addons - MUST TO BE LAST!!! NDS_SLOT2_COUNT // use for counter addons - MUST TO BE LAST!!!
}; };
@ -142,6 +143,7 @@ bool slot2_read(u32 addr, T &val);
extern std::string GBACartridge_RomPath; extern std::string GBACartridge_RomPath;
extern std::string GBACartridge_SRAMPath; extern std::string GBACartridge_SRAMPath;
extern void (*FeedbackON)(bool enable); // feedback on/off extern void (*FeedbackON)(bool enable); // feedback on/off
extern char hcv1000_data[16];
enum ADDON_CFLASH_MODE enum ADDON_CFLASH_MODE
{ {
@ -157,4 +159,5 @@ void Paddle_SetValue(u16 theValue);
extern void guitarGrip_setKey(bool green, bool red, bool yellow, bool blue); // Guitar grip keys extern void guitarGrip_setKey(bool green, bool red, bool yellow, bool blue); // Guitar grip keys
extern void piano_setKey(bool c, bool cs, bool d, bool ds, bool e, bool f, bool fs, bool g, bool gs, bool a, bool as, bool b, bool hic); //piano keys extern void piano_setKey(bool c, bool cs, bool d, bool ds, bool e, bool f, bool fs, bool g, bool gs, bool a, bool as, bool b, bool hic); //piano keys
extern void HCV1000_setReady();
#endif //__SLOT_H__ #endif //__SLOT_H__