mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-30 01:29:42 -06:00
Remove incorrect usage of "ASCII" and "ANSI"
Windows-1252 was sometimes being referred to as ASCII or ANSI in Dolphin, which is incorrect. ASCII is only a subset of Windows-1252, and ANSI is (rather improperly) used in Windows to refer to the current code page (which often is 1252 on Western systems, but can also be something entirely different). The commit also replaces "SJIS" with "Shift JIS". "SJIS" isn't misleading, but "Shift JIS" is more commonly used.
This commit is contained in:
@ -106,8 +106,8 @@
|
||||
// Sys files
|
||||
#define TOTALDB "totaldb.dsy"
|
||||
|
||||
#define FONT_ANSI "font_ansi.bin"
|
||||
#define FONT_SJIS "font_sjis.bin"
|
||||
#define FONT_WINDOWS_1252 "font_western.bin"
|
||||
#define FONT_SHIFT_JIS "font_japanese.bin"
|
||||
|
||||
#define DSP_IROM "dsp_rom.bin"
|
||||
#define DSP_COEF "dsp_coef.bin"
|
||||
|
@ -101,8 +101,8 @@ CEXIIPL::CEXIIPL() : m_uPosition(0), m_uAddress(0), m_uRWOffset(0), m_FontsLoade
|
||||
m_bNTSC ? sizeof(iplverNTSC) : sizeof(iplverPAL));
|
||||
|
||||
// Load fonts
|
||||
LoadFontFile((File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + FONT_SJIS), 0x1aff00);
|
||||
LoadFontFile((File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + FONT_ANSI), 0x1fcf00);
|
||||
LoadFontFile((File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + FONT_SHIFT_JIS), 0x1aff00);
|
||||
LoadFontFile((File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + FONT_WINDOWS_1252), 0x1fcf00);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -199,12 +199,12 @@ void CEXIIPL::LoadFontFile(const std::string& filename, u32 offset)
|
||||
if (!stream)
|
||||
return;
|
||||
|
||||
// Official Windows-1252 and SJIS fonts present on the IPL dumps are 0x2575 and 0x4a24d bytes
|
||||
// long respectively, so, determine the size of the font being loaded based on the offset
|
||||
// Official Windows-1252 and Shift JIS fonts present on the IPL dumps are 0x2575 and 0x4a24d
|
||||
// bytes long respectively, so, determine the size of the font being loaded based on the offset
|
||||
u64 fontsize = (offset == 0x1aff00) ? 0x4a24d : 0x2575;
|
||||
|
||||
INFO_LOG(BOOT, "Found IPL dump, loading %s font from %s",
|
||||
((offset == 0x1aff00) ? "SJIS" : "Windows-1252"), (ipl_rom_path).c_str());
|
||||
((offset == 0x1aff00) ? "Shift JIS" : "Windows-1252"), (ipl_rom_path).c_str());
|
||||
|
||||
stream.Seek(offset, 0);
|
||||
stream.ReadBytes(m_pIPL + offset, fontsize);
|
||||
@ -374,9 +374,16 @@ void CEXIIPL::TransferByte(u8& _uByte)
|
||||
|
||||
if ((position >= 0x001AFF00) && (position <= 0x001FF474) && !m_FontsLoaded)
|
||||
{
|
||||
PanicAlertT("Error: Trying to access %s fonts but they are not loaded. "
|
||||
"Games may not show fonts correctly, or crash.",
|
||||
(position >= 0x001FCF00) ? "ANSI" : "SJIS");
|
||||
if (position >= 0x001FCF00)
|
||||
{
|
||||
PanicAlertT("Error: Trying to access Windows-1252 fonts but they are not loaded. "
|
||||
"Games may not show fonts correctly, or crash.");
|
||||
}
|
||||
else
|
||||
{
|
||||
PanicAlertT("Error: Trying to access Shift JIS fonts but they are not loaded. "
|
||||
"Games may not show fonts correctly, or crash.");
|
||||
}
|
||||
m_FontsLoaded = true; // Don't be a nag :p
|
||||
}
|
||||
}
|
||||
|
@ -171,12 +171,12 @@ void CEXIMemoryCard::SetupGciFolder(u16 sizeMb)
|
||||
country_code = DiscIO::CountrySwitch(game_id.at(3));
|
||||
CurrentGameId = BE32((u8*)game_id.c_str());
|
||||
}
|
||||
bool ascii = true;
|
||||
bool shift_jis = false;
|
||||
std::string strDirectoryName = File::GetUserPath(D_GCUSER_IDX);
|
||||
switch (country_code)
|
||||
{
|
||||
case DiscIO::Country::COUNTRY_JAPAN:
|
||||
ascii = false;
|
||||
shift_jis = true;
|
||||
strDirectoryName += JAP_DIR DIR_SEP;
|
||||
break;
|
||||
case DiscIO::Country::COUNTRY_USA:
|
||||
@ -203,7 +203,7 @@ void CEXIMemoryCard::SetupGciFolder(u16 sizeMb)
|
||||
if (region == JAP_DIR)
|
||||
{
|
||||
country_code = DiscIO::Country::COUNTRY_JAPAN;
|
||||
ascii = false;
|
||||
shift_jis = true;
|
||||
strDirectoryName += JAP_DIR DIR_SEP;
|
||||
break;
|
||||
}
|
||||
@ -243,7 +243,7 @@ void CEXIMemoryCard::SetupGciFolder(u16 sizeMb)
|
||||
}
|
||||
|
||||
memorycard = std::make_unique<GCMemcardDirectory>(strDirectoryName + DIR_SEP, card_index, sizeMb,
|
||||
ascii, country_code, CurrentGameId);
|
||||
shift_jis, country_code, CurrentGameId);
|
||||
}
|
||||
|
||||
void CEXIMemoryCard::SetupRawMemcard(u16 sizeMb)
|
||||
|
@ -22,7 +22,7 @@ static void ByteSwap(u8* valueA, u8* valueB)
|
||||
*valueB = tmp;
|
||||
}
|
||||
|
||||
GCMemcard::GCMemcard(const std::string& filename, bool forceCreation, bool ascii)
|
||||
GCMemcard::GCMemcard(const std::string& filename, bool forceCreation, bool shift_jis)
|
||||
: m_valid(false), m_fileName(filename)
|
||||
{
|
||||
// Currently there is a string freeze. instead of adding a new message about needing r/w
|
||||
@ -34,9 +34,10 @@ GCMemcard::GCMemcard(const std::string& filename, bool forceCreation, bool ascii
|
||||
{
|
||||
if (!AskYesNoT("\"%s\" does not exist.\n Create a new 16MB Memcard?", filename.c_str()))
|
||||
return;
|
||||
ascii = AskYesNoT("Format as ASCII (NTSC\\PAL)?\nChoose no for Shift JIS (NTSC-J)");
|
||||
shift_jis =
|
||||
AskYesNoT("Format as Shift JIS (Japanese)?\nChoose no for Windows-1252 (Western)");
|
||||
}
|
||||
Format(ascii);
|
||||
Format(shift_jis);
|
||||
return;
|
||||
}
|
||||
else
|
||||
@ -226,9 +227,9 @@ void GCMemcard::InitDirBatPointers()
|
||||
}
|
||||
}
|
||||
|
||||
bool GCMemcard::IsAsciiEncoding() const
|
||||
bool GCMemcard::IsShiftJIS() const
|
||||
{
|
||||
return hdr.Encoding == 0;
|
||||
return hdr.Encoding == 1;
|
||||
}
|
||||
|
||||
bool GCMemcard::Save()
|
||||
@ -1223,14 +1224,14 @@ u32 GCMemcard::ReadAnimRGBA8(u8 index, u32* buffer, u8* delays) const
|
||||
return frames;
|
||||
}
|
||||
|
||||
bool GCMemcard::Format(u8* card_data, bool ascii, u16 SizeMb)
|
||||
bool GCMemcard::Format(u8* card_data, bool shift_jis, u16 SizeMb)
|
||||
{
|
||||
if (!card_data)
|
||||
return false;
|
||||
memset(card_data, 0xFF, BLOCK_SIZE * 3);
|
||||
memset(card_data + BLOCK_SIZE * 3, 0, BLOCK_SIZE * 2);
|
||||
|
||||
*((Header*)card_data) = Header(SLOT_A, SizeMb, ascii);
|
||||
*((Header*)card_data) = Header(SLOT_A, SizeMb, shift_jis);
|
||||
|
||||
*((Directory*)(card_data + BLOCK_SIZE)) = Directory();
|
||||
*((Directory*)(card_data + BLOCK_SIZE * 2)) = Directory();
|
||||
@ -1239,7 +1240,7 @@ bool GCMemcard::Format(u8* card_data, bool ascii, u16 SizeMb)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GCMemcard::Format(bool ascii, u16 SizeMb)
|
||||
bool GCMemcard::Format(bool shift_jis, u16 SizeMb)
|
||||
{
|
||||
memset(&hdr, 0xFF, BLOCK_SIZE);
|
||||
memset(&dir, 0xFF, BLOCK_SIZE);
|
||||
@ -1247,7 +1248,7 @@ bool GCMemcard::Format(bool ascii, u16 SizeMb)
|
||||
memset(&bat, 0, BLOCK_SIZE);
|
||||
memset(&bat_backup, 0, BLOCK_SIZE);
|
||||
|
||||
hdr = Header(SLOT_A, SizeMb, ascii);
|
||||
hdr = Header(SLOT_A, SizeMb, shift_jis);
|
||||
dir = dir_backup = Directory();
|
||||
bat = bat_backup = BlockAlloc(SizeMb);
|
||||
|
||||
|
@ -126,11 +126,11 @@ struct Header // Offset Size Description
|
||||
// Nintendo format algorithm.
|
||||
// Constants are fixed by the GC SDK
|
||||
// Changing the constants will break memory card support
|
||||
Header(int slot = 0, u16 sizeMb = MemCard2043Mb, bool ascii = true)
|
||||
Header(int slot = 0, u16 sizeMb = MemCard2043Mb, bool shift_jis = false)
|
||||
{
|
||||
memset(this, 0xFF, BLOCK_SIZE);
|
||||
*(u16*)SizeMb = BE16(sizeMb);
|
||||
Encoding = BE16(ascii ? 0 : 1);
|
||||
Encoding = BE16(shift_jis ? 1 : 0);
|
||||
u64 rand = CEXIIPL::GetEmulatedTime(CEXIIPL::GC_EPOCH);
|
||||
formatTime = Common::swap64(rand);
|
||||
for (int i = 0; i < 12; i++)
|
||||
@ -308,12 +308,12 @@ private:
|
||||
void InitDirBatPointers();
|
||||
|
||||
public:
|
||||
GCMemcard(const std::string& fileName, bool forceCreation = false, bool sjis = false);
|
||||
GCMemcard(const std::string& fileName, bool forceCreation = false, bool shift_jis = false);
|
||||
bool IsValid() const { return m_valid; }
|
||||
bool IsAsciiEncoding() const;
|
||||
bool IsShiftJIS() const;
|
||||
bool Save();
|
||||
bool Format(bool ascii = true, u16 SizeMb = MemCard2043Mb);
|
||||
static bool Format(u8* card_data, bool ascii = true, u16 SizeMb = MemCard2043Mb);
|
||||
bool Format(bool shift_jis = false, u16 SizeMb = MemCard2043Mb);
|
||||
static bool Format(u8* card_data, bool shift_jis = false, u16 SizeMb = MemCard2043Mb);
|
||||
static s32 FZEROGX_MakeSaveGameValid(Header& cardheader, DEntry& direntry,
|
||||
std::vector<GCMBlock>& FileBuffer);
|
||||
static s32 PSO_MakeSaveGameValid(Header& cardheader, DEntry& direntry,
|
||||
|
@ -146,9 +146,10 @@ int GCMemcardDirectory::LoadGCI(const std::string& fileName, DiscIO::Country car
|
||||
}
|
||||
|
||||
GCMemcardDirectory::GCMemcardDirectory(const std::string& directory, int slot, u16 sizeMb,
|
||||
bool ascii, DiscIO::Country card_region, int gameId)
|
||||
: MemoryCardBase(slot, sizeMb), m_GameId(gameId), m_LastBlock(-1), m_hdr(slot, sizeMb, ascii),
|
||||
m_bat1(sizeMb), m_saves(0), m_SaveDirectory(directory), m_exiting(false)
|
||||
bool shift_jis, DiscIO::Country card_region, int gameId)
|
||||
: MemoryCardBase(slot, sizeMb), m_GameId(gameId), m_LastBlock(-1),
|
||||
m_hdr(slot, sizeMb, shift_jis), m_bat1(sizeMb), m_saves(0), m_SaveDirectory(directory),
|
||||
m_exiting(false)
|
||||
{
|
||||
// Use existing header data if available
|
||||
if (File::Exists(m_SaveDirectory + MC_HDR))
|
||||
|
@ -23,7 +23,7 @@ class GCMemcardDirectory : public MemoryCardBase, NonCopyable
|
||||
{
|
||||
public:
|
||||
GCMemcardDirectory(const std::string& directory, int slot = 0, u16 sizeMb = MemCard2043Mb,
|
||||
bool ascii = true,
|
||||
bool shift_jis = false,
|
||||
DiscIO::Country card_region = DiscIO::Country::COUNTRY_EUROPE, int gameId = 0);
|
||||
~GCMemcardDirectory();
|
||||
void FlushToFile();
|
||||
|
@ -735,7 +735,7 @@ bool CMemcardManager::ReloadMemcard(const std::string& fileName, int card)
|
||||
std::string title = memoryCard[card]->GetSaveComment1(fileIndex);
|
||||
std::string comment = memoryCard[card]->GetSaveComment2(fileIndex);
|
||||
|
||||
auto const string_decoder = memoryCard[card]->IsAsciiEncoding() ? CP1252ToUTF8 : SHIFTJISToUTF8;
|
||||
auto const string_decoder = memoryCard[card]->IsShiftJIS() ? SHIFTJISToUTF8 : CP1252ToUTF8;
|
||||
|
||||
wxTitle = StrToWxStr(string_decoder(title));
|
||||
wxComment = StrToWxStr(string_decoder(comment));
|
||||
|
Reference in New Issue
Block a user