mirror of
https://github.com/TASVideos/desmume
synced 2024-07-03 08:18:44 +00:00
Compare commits
5 Commits
2a9b960ddc
...
0f6f54b151
Author | SHA1 | Date | |
---|---|---|---|
|
0f6f54b151 | ||
|
90d0abdae0 | ||
|
738298a9e8 | ||
|
4a53a30b91 | ||
|
be53737eba |
|
@ -20,9 +20,15 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "../slot2.h"
|
#include "../slot2.h"
|
||||||
|
#include "../emufile.h"
|
||||||
|
|
||||||
u8 hcv1000_cnt;
|
static u8 hcv1000_cnt;
|
||||||
char hcv1000_data[16];
|
static u8 hcv1000_data[16] =
|
||||||
|
{ 0x5F, 0x5F, 0x5F, 0x5F,
|
||||||
|
0x5F, 0x5F, 0x5F, 0x5F,
|
||||||
|
0x5F, 0x5F, 0x5F, 0x5F,
|
||||||
|
0x5F, 0x5F, 0x5F, 0x5F
|
||||||
|
};
|
||||||
|
|
||||||
class Slot2_HCV1000 : public ISlot2Interface
|
class Slot2_HCV1000 : public ISlot2Interface
|
||||||
{
|
{
|
||||||
|
@ -34,17 +40,15 @@ public:
|
||||||
return &info;
|
return &info;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool init()
|
virtual void connect()
|
||||||
{
|
{
|
||||||
hcv1000_cnt = 0;
|
hcv1000_cnt = 0;
|
||||||
memset(hcv1000_data, 0x5F, 16);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void writeByte(u8 PROCNUM, u32 addr, u8 val)
|
virtual void writeByte(u8 PROCNUM, u32 addr, u8 val)
|
||||||
{
|
{
|
||||||
if (addr == 0xA000000) { hcv1000_cnt = (val & 0x83); }
|
if (addr == 0xA000000)
|
||||||
|
hcv1000_cnt = (val & 0x83);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual u8 readByte(u8 PROCNUM, u32 addr)
|
virtual u8 readByte(u8 PROCNUM, u32 addr)
|
||||||
|
@ -58,12 +62,15 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
//HCV_CNT
|
//HCV_CNT
|
||||||
else if (addr == 0xA000000) { slot_byte = hcv1000_cnt; }
|
else if (addr == 0xA000000)
|
||||||
|
{
|
||||||
|
slot_byte = hcv1000_cnt;
|
||||||
|
}
|
||||||
|
|
||||||
//HCV_DATA
|
//HCV_DATA
|
||||||
else if ((addr >= 0xA000010) && (addr <= 0xA00001F))
|
else if ((addr >= 0xA000010) && (addr <= 0xA00001F))
|
||||||
{
|
{
|
||||||
slot_byte = (u8)hcv1000_data[addr & 0xF];
|
slot_byte = hcv1000_data[addr & 0xF];
|
||||||
}
|
}
|
||||||
|
|
||||||
return slot_byte;
|
return slot_byte;
|
||||||
|
@ -71,6 +78,24 @@ public:
|
||||||
|
|
||||||
virtual u16 readWord(u8 PROCNUM, u32 addr) { return 0xFDFD; };
|
virtual u16 readWord(u8 PROCNUM, u32 addr) { return 0xFDFD; };
|
||||||
virtual u32 readLong(u8 PROCNUM, u32 addr) { return 0xFDFDFDFD; };
|
virtual u32 readLong(u8 PROCNUM, u32 addr) { return 0xFDFDFDFD; };
|
||||||
|
|
||||||
|
virtual void savestate(EMUFILE &os)
|
||||||
|
{
|
||||||
|
s32 version = 0;
|
||||||
|
os.write_32LE(version);
|
||||||
|
|
||||||
|
os.write_u8(hcv1000_cnt);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void loadstate(EMUFILE &is)
|
||||||
|
{
|
||||||
|
s32 version = is.read_s32LE();
|
||||||
|
|
||||||
|
if (version >= 0)
|
||||||
|
{
|
||||||
|
is.read_u8(hcv1000_cnt);
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ISlot2Interface* construct_Slot2_HCV1000() { return new Slot2_HCV1000(); }
|
ISlot2Interface* construct_Slot2_HCV1000() { return new Slot2_HCV1000(); }
|
||||||
|
|
|
@ -87,7 +87,7 @@ void GetINIPath()
|
||||||
}
|
}
|
||||||
|
|
||||||
FCEUD_MakePathDirs(IniName);
|
FCEUD_MakePathDirs(IniName);
|
||||||
wcscpy(IniNameW,mbstowcs(IniName).c_str()); //careful to use locale C-style mbstowcs to get IniName (which is with locale encoding) to unicode
|
wcscpy(IniNameW,mbstowcs_locale(IniName).c_str());
|
||||||
|
|
||||||
//write BOM to get unicode
|
//write BOM to get unicode
|
||||||
FILE* test = fopen(IniName,"rb");
|
FILE* test = fopen(IniName,"rb");
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define _XOPEN_SOURCE 500 /* For strdup, realpath */
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <boolean.h>
|
#include <boolean.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
|
@ -170,7 +170,7 @@ void createDirectoryRecursively(std::wstring path)
|
||||||
|
|
||||||
void FCEUD_MakePathDirs(const char *fname)
|
void FCEUD_MakePathDirs(const char *fname)
|
||||||
{
|
{
|
||||||
createDirectoryRecursively(mbstowcs(fname));
|
createDirectoryRecursively(mbstowcs_locale(fname));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
//------------------------------
|
//------------------------------
|
||||||
|
|
|
@ -284,6 +284,19 @@ std::string mass_replace(const std::string &source, const std::string &victim, c
|
||||||
return answer;
|
return answer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::wstring mbstowcs_locale(std::string str)
|
||||||
|
{
|
||||||
|
#ifdef HOST_WINDOWS
|
||||||
|
int plenty = str.size()*4+1;
|
||||||
|
wchar_t *wgarbage = new wchar_t[plenty];
|
||||||
|
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, str.data(), -1, wgarbage, plenty);
|
||||||
|
std::wstring ret = wgarbage;
|
||||||
|
delete[] wgarbage;
|
||||||
|
return ret;
|
||||||
|
#endif
|
||||||
|
return mbstowcs(str);
|
||||||
|
}
|
||||||
|
|
||||||
//convert a std::string to std::wstring
|
//convert a std::string to std::wstring
|
||||||
std::wstring mbstowcs(std::string str)
|
std::wstring mbstowcs(std::string str)
|
||||||
{
|
{
|
||||||
|
|
|
@ -107,5 +107,7 @@ std::string mass_replace(const std::string &source, const std::string &victim, c
|
||||||
std::wstring mbstowcs(std::string str);
|
std::wstring mbstowcs(std::string str);
|
||||||
std::string wcstombs(std::wstring str);
|
std::string wcstombs(std::wstring str);
|
||||||
|
|
||||||
|
std::wstring mbstowcs_locale(std::string str);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue
Block a user