diff --git a/bsnes/nall/config.hpp b/bsnes/nall/config.hpp
index f555158e..b8381b16 100755
--- a/bsnes/nall/config.hpp
+++ b/bsnes/nall/config.hpp
@@ -45,11 +45,11 @@ namespace nall {
void set(string s) {
switch(type) {
- case boolean_t: *(bool*)data = (s == "true"); break;
- case signed_t: *(signed*)data = strsigned(s); break;
- case unsigned_t: *(unsigned*)data = strunsigned(s); break;
- case double_t: *(double*)data = strdouble(s); break;
- case string_t: s.trim("\""); *(string*)data = s; break;
+ case boolean_t: *(bool*)data = (s == "true"); break;
+ case signed_t: *(signed*)data = integer(s); break;
+ case unsigned_t: *(unsigned*)data = decimal(s); break;
+ case double_t: *(double*)data = fp(s); break;
+ case string_t: s.trim("\""); *(string*)data = s; break;
}
}
};
diff --git a/bsnes/nall/input.hpp b/bsnes/nall/input.hpp
index 28b10453..1fd680f4 100755
--- a/bsnes/nall/input.hpp
+++ b/bsnes/nall/input.hpp
@@ -92,7 +92,7 @@ struct Keyboard {
string s(name);
if(!strbegin(name, "KB")) return 0;
s.ltrim("KB");
- unsigned id = strunsigned(s);
+ unsigned id = decimal(s);
auto pos = strpos(s, "::");
if(!pos) return 0;
s = substr(s, pos() + 2);
@@ -189,7 +189,7 @@ struct Mouse {
string s(name);
if(!strbegin(name, "MS")) return 0;
s.ltrim("MS");
- unsigned id = strunsigned(s);
+ unsigned id = decimal(s);
auto pos = strpos(s, "::");
if(!pos) return 0;
s = substr(s, pos() + 2);
@@ -313,7 +313,7 @@ struct Joypad {
string s(name);
if(!strbegin(name, "JP")) return 0;
s.ltrim("JP");
- unsigned id = strunsigned(s);
+ unsigned id = decimal(s);
auto pos = strpos(s, "::");
if(!pos) return 0;
s = substr(s, pos() + 2);
diff --git a/bsnes/nall/snes/cartridge.hpp b/bsnes/nall/snes/cartridge.hpp
index 1305247a..27434a18 100755
--- a/bsnes/nall/snes/cartridge.hpp
+++ b/bsnes/nall/snes/cartridge.hpp
@@ -125,7 +125,7 @@ SNESCartridge::SNESCartridge(const uint8_t *data, unsigned size) {
if(type == TypeGameBoy) {
xml << "\n";
if(gameboy_ram_size(data, size) > 0) {
- xml << " \n";
+ xml << " \n";
}
xml << "\n";
xmlMemoryMap = xml;
@@ -171,9 +171,9 @@ SNESCartridge::SNESCartridge(const uint8_t *data, unsigned size) {
xml << " \n";
xml << " \n";
- xml << " \n";
+ xml << " \n";
xml << " \n";
- xml << " \n";
+ xml << " \n";
xml << " \n";
xml << " \n";
xml << " \n";
@@ -198,7 +198,7 @@ SNESCartridge::SNESCartridge(const uint8_t *data, unsigned size) {
xml << " \n";
if(ram_size > 0) {
- xml << " \n";
+ xml << " \n";
xml << " \n";
xml << " \n";
if((rom_size > 0x200000) || (ram_size > 32 * 1024)) {
@@ -219,7 +219,7 @@ SNESCartridge::SNESCartridge(const uint8_t *data, unsigned size) {
xml << " \n";
if(ram_size > 0) {
- xml << " \n";
+ xml << " \n";
xml << " \n";
xml << " \n";
if((rom_size > 0x200000) || (ram_size > 32 * 1024)) {
@@ -237,7 +237,7 @@ SNESCartridge::SNESCartridge(const uint8_t *data, unsigned size) {
xml << " \n";
if(ram_size > 0) {
- xml << " \n";
+ xml << " \n";
xml << " \n";
xml << " \n";
xml << " \n";
@@ -252,7 +252,7 @@ SNESCartridge::SNESCartridge(const uint8_t *data, unsigned size) {
xml << " \n";
if(ram_size > 0) {
- xml << " \n";
+ xml << " \n";
xml << " \n";
xml << " \n";
if((rom_size > 0x200000) || (ram_size > 32 * 1024)) {
@@ -270,7 +270,7 @@ SNESCartridge::SNESCartridge(const uint8_t *data, unsigned size) {
xml << " \n";
xml << " \n";
xml << " \n";
- xml << " \n";
+ xml << " \n";
xml << " \n";
xml << " \n";
xml << " \n";
@@ -292,7 +292,7 @@ SNESCartridge::SNESCartridge(const uint8_t *data, unsigned size) {
xml << " \n";
xml << " \n";
xml << " \n";
- xml << " \n";
+ xml << " \n";
xml << " \n";
xml << " \n";
xml << " \n";
@@ -309,7 +309,7 @@ SNESCartridge::SNESCartridge(const uint8_t *data, unsigned size) {
xml << " \n";
xml << " \n";
xml << " \n";
- xml << " \n";
+ xml << " \n";
xml << " \n";
xml << " \n";
xml << " \n";
@@ -325,7 +325,7 @@ SNESCartridge::SNESCartridge(const uint8_t *data, unsigned size) {
xml << " \n";
xml << " \n";
xml << " \n";
- xml << " \n";
+ xml << " \n";
xml << " \n";
xml << " \n";
xml << " \n";
@@ -408,7 +408,7 @@ SNESCartridge::SNESCartridge(const uint8_t *data, unsigned size) {
}
if(has_dsp1) {
- xml << " \n";
+ xml << " \n";
if(dsp1_mapper == DSP1LoROM1MB) {
xml << " \n";
xml << " \n";
@@ -441,7 +441,7 @@ SNESCartridge::SNESCartridge(const uint8_t *data, unsigned size) {
}
if(has_dsp2) {
- xml << " \n";
+ xml << " \n";
xml << " \n";
xml << " \n";
xml << " \n";
@@ -450,11 +450,11 @@ SNESCartridge::SNESCartridge(const uint8_t *data, unsigned size) {
xml << " \n";
xml << " \n";
xml << " \n";
- xml << " \n";
+ xml << " \n";
}
if(has_dsp3) {
- xml << " \n";
+ xml << " \n";
xml << " \n";
xml << " \n";
xml << " \n";
@@ -463,11 +463,11 @@ SNESCartridge::SNESCartridge(const uint8_t *data, unsigned size) {
xml << " \n";
xml << " \n";
xml << " \n";
- xml << " \n";
+ xml << " \n";
}
if(has_dsp4) {
- xml << " \n";
+ xml << " \n";
xml << " \n";
xml << " \n";
xml << " \n";
@@ -476,7 +476,7 @@ SNESCartridge::SNESCartridge(const uint8_t *data, unsigned size) {
xml << " \n";
xml << " \n";
xml << " \n";
- xml << " \n";
+ xml << " \n";
}
if(has_obc1) {
diff --git a/bsnes/nall/snes/cpu.hpp b/bsnes/nall/snes/cpu.hpp
index f6a1c8ff..28f5ddb5 100755
--- a/bsnes/nall/snes/cpu.hpp
+++ b/bsnes/nall/snes/cpu.hpp
@@ -418,36 +418,36 @@ inline string SNESCPU::disassemble(unsigned pc, bool accum, bool index, uint8_t
unsigned mode = opcodeInfo[opcode].mode;
if(mode == Implied) return name;
- if(mode == Constant) return { name, " #$", strhex<2>(pl) };
- if(mode == AccumConstant) return { name, " #$", accum ? "" : strhex<2>(ph), strhex<2>(pl) };
- if(mode == IndexConstant) return { name, " #$", index ? "" : strhex<2>(ph), strhex<2>(pl) };
- if(mode == Direct) return { name, " $", strhex<2>(pl) };
- if(mode == DirectX) return { name, " $", strhex<2>(pl), ",x" };
- if(mode == DirectY) return { name, " $", strhex<2>(pl), ",y" };
- if(mode == IDirect) return { name, " ($", strhex<2>(pl), ")" };
- if(mode == IDirectX) return { name, " ($", strhex<2>(pl), ",x)" };
- if(mode == IDirectY) return { name, " ($", strhex<2>(pl), "),y" };
- if(mode == ILDirect) return { name, " [$", strhex<2>(pl), "]" };
- if(mode == ILDirectY) return { name, " [$", strhex<2>(pl), "],y" };
- if(mode == Address) return { name, " $", strhex<2>(ph), strhex<2>(pl) };
- if(mode == AddressX) return { name, " $", strhex<2>(ph), strhex<2>(pl), ",x" };
- if(mode == AddressY) return { name, " $", strhex<2>(ph), strhex<2>(pl), ",y" };
- if(mode == IAddressX) return { name, " ($", strhex<2>(ph), strhex<2>(pl), ",x)" };
- if(mode == ILAddress) return { name, " [$", strhex<2>(ph), strhex<2>(pl), "]" };
- if(mode == PAddress) return { name, " $", strhex<2>(ph), strhex<2>(pl) };
- if(mode == PIAddress) return { name, " ($", strhex<2>(ph), strhex<2>(pl), ")" };
- if(mode == Long) return { name, " $", strhex<2>(pb), strhex<2>(ph), strhex<2>(pl) };
- if(mode == LongX) return { name, " $", strhex<2>(pb), strhex<2>(ph), strhex<2>(pl), ",x" };
- if(mode == Stack) return { name, " $", strhex<2>(pl), ",s" };
- if(mode == IStackY) return { name, " ($", strhex<2>(pl), ",s),y" };
- if(mode == BlockMove) return { name, " $", strhex<2>(ph), ",$", strhex<2>(pl) };
+ if(mode == Constant) return { name, " #$", hex<2>(pl) };
+ if(mode == AccumConstant) return { name, " #$", accum ? "" : hex<2>(ph), hex<2>(pl) };
+ if(mode == IndexConstant) return { name, " #$", index ? "" : hex<2>(ph), hex<2>(pl) };
+ if(mode == Direct) return { name, " $", hex<2>(pl) };
+ if(mode == DirectX) return { name, " $", hex<2>(pl), ",x" };
+ if(mode == DirectY) return { name, " $", hex<2>(pl), ",y" };
+ if(mode == IDirect) return { name, " ($", hex<2>(pl), ")" };
+ if(mode == IDirectX) return { name, " ($", hex<2>(pl), ",x)" };
+ if(mode == IDirectY) return { name, " ($", hex<2>(pl), "),y" };
+ if(mode == ILDirect) return { name, " [$", hex<2>(pl), "]" };
+ if(mode == ILDirectY) return { name, " [$", hex<2>(pl), "],y" };
+ if(mode == Address) return { name, " $", hex<2>(ph), hex<2>(pl) };
+ if(mode == AddressX) return { name, " $", hex<2>(ph), hex<2>(pl), ",x" };
+ if(mode == AddressY) return { name, " $", hex<2>(ph), hex<2>(pl), ",y" };
+ if(mode == IAddressX) return { name, " ($", hex<2>(ph), hex<2>(pl), ",x)" };
+ if(mode == ILAddress) return { name, " [$", hex<2>(ph), hex<2>(pl), "]" };
+ if(mode == PAddress) return { name, " $", hex<2>(ph), hex<2>(pl) };
+ if(mode == PIAddress) return { name, " ($", hex<2>(ph), hex<2>(pl), ")" };
+ if(mode == Long) return { name, " $", hex<2>(pb), hex<2>(ph), hex<2>(pl) };
+ if(mode == LongX) return { name, " $", hex<2>(pb), hex<2>(ph), hex<2>(pl), ",x" };
+ if(mode == Stack) return { name, " $", hex<2>(pl), ",s" };
+ if(mode == IStackY) return { name, " ($", hex<2>(pl), ",s),y" };
+ if(mode == BlockMove) return { name, " $", hex<2>(ph), ",$", hex<2>(pl) };
if(mode == RelativeShort) {
unsigned addr = (pc + 2) + (int8_t)(pl << 0);
- return { name, " $", strhex<4>(addr) };
+ return { name, " $", hex<4>(addr) };
}
if(mode == RelativeLong) {
unsigned addr = (pc + 3) + (int16_t)((ph << 8) + (pl << 0));
- return { name, " $", strhex<4>(addr) };
+ return { name, " $", hex<4>(addr) };
}
return "";
diff --git a/bsnes/nall/snes/smp.hpp b/bsnes/nall/snes/smp.hpp
index 83c9696a..7a1ac47b 100755
--- a/bsnes/nall/snes/smp.hpp
+++ b/bsnes/nall/snes/smp.hpp
@@ -495,67 +495,67 @@ inline string SNESSMP::disassemble(uint16_t pc, uint8_t opcode, uint8_t pl, uint
if(mode == Implied) return name;
if(mode == TVector) return { name, " ", opcode >> 4 };
- if(mode == Direct) return { name, " $", strhex<2>(pl) };
- if(mode == DirectRelative) return { name, " $", strhex<2>(pl), ",$", strhex<4>(pc + 3 + (int8_t)ph) };
- if(mode == ADirect) return { name, " a,$", strhex<2>(pl) };
- if(mode == AAbsolute) return { name, " a,$", strhex<4>(pa) };
+ if(mode == Direct) return { name, " $", hex<2>(pl) };
+ if(mode == DirectRelative) return { name, " $", hex<2>(pl), ",$", hex<4>(pc + 3 + (int8_t)ph) };
+ if(mode == ADirect) return { name, " a,$", hex<2>(pl) };
+ if(mode == AAbsolute) return { name, " a,$", hex<4>(pa) };
if(mode == AIX) return { name, "a,(x)" };
- if(mode == AIDirectX) return { name, " a,($", strhex<2>(pl), "+x)" };
- if(mode == AConstant) return { name, " a,#$", strhex<2>(pl) };
- if(mode == DirectDirect) return { name, " $", strhex<2>(ph), ",$", strhex<2>(pl) };
- if(mode == CAbsoluteBit) return { name, " c,$", strhex<4>(pa & 0x1fff), ":", pa >> 13 };
- if(mode == Absolute) return { name, " $", strhex<4>(pa) };
+ if(mode == AIDirectX) return { name, " a,($", hex<2>(pl), "+x)" };
+ if(mode == AConstant) return { name, " a,#$", hex<2>(pl) };
+ if(mode == DirectDirect) return { name, " $", hex<2>(ph), ",$", hex<2>(pl) };
+ if(mode == CAbsoluteBit) return { name, " c,$", hex<4>(pa & 0x1fff), ":", pa >> 13 };
+ if(mode == Absolute) return { name, " $", hex<4>(pa) };
if(mode == P) return { name, " p" };
- if(mode == AbsoluteA) return { name, " $", strhex<4>(pa), ",a" };
- if(mode == Relative) return { name, " $", strhex<4>(pc + 2 + (int8_t)pl) };
- if(mode == ADirectX) return { name, " a,$", strhex<2>(pl), "+x" };
- if(mode == AAbsoluteX) return { name, " a,$", strhex<4>(pa), "+x" };
- if(mode == AAbsoluteY) return { name, " a,$", strhex<4>(pa), "+y" };
- if(mode == AIDirectY) return { name, " a,($", strhex<2>(pl), ")+y" };
- if(mode == DirectConstant) return { name, " $", strhex<2>(ph), ",#$", strhex<2>(pl) };
+ if(mode == AbsoluteA) return { name, " $", hex<4>(pa), ",a" };
+ if(mode == Relative) return { name, " $", hex<4>(pc + 2 + (int8_t)pl) };
+ if(mode == ADirectX) return { name, " a,$", hex<2>(pl), "+x" };
+ if(mode == AAbsoluteX) return { name, " a,$", hex<4>(pa), "+x" };
+ if(mode == AAbsoluteY) return { name, " a,$", hex<4>(pa), "+y" };
+ if(mode == AIDirectY) return { name, " a,($", hex<2>(pl), ")+y" };
+ if(mode == DirectConstant) return { name, " $", hex<2>(ph), ",#$", hex<2>(pl) };
if(mode == IXIY) return { name, " (x),(y)" };
- if(mode == DirectX) return { name, " $", strhex<2>(pl), "+x" };
+ if(mode == DirectX) return { name, " $", hex<2>(pl), "+x" };
if(mode == A) return { name, " a" };
if(mode == X) return { name, " x" };
- if(mode == XAbsolute) return { name, " x,$", strhex<4>(pa) };
- if(mode == IAbsoluteX) return { name, " ($", strhex<4>(pa), "+x)" };
- if(mode == CNAbsoluteBit) return { name, " c,!$", strhex<4>(pa & 0x1fff), ":", pa >> 13 };
- if(mode == XDirect) return { name, " x,$", strhex<2>(pl) };
- if(mode == PVector) return { name, " $ff", strhex<2>(pl) };
- if(mode == YaDirect) return { name, " ya,$", strhex<2>(pl) };
+ if(mode == XAbsolute) return { name, " x,$", hex<4>(pa) };
+ if(mode == IAbsoluteX) return { name, " ($", hex<4>(pa), "+x)" };
+ if(mode == CNAbsoluteBit) return { name, " c,!$", hex<4>(pa & 0x1fff), ":", pa >> 13 };
+ if(mode == XDirect) return { name, " x,$", hex<2>(pl) };
+ if(mode == PVector) return { name, " $ff", hex<2>(pl) };
+ if(mode == YaDirect) return { name, " ya,$", hex<2>(pl) };
if(mode == XA) return { name, " x,a" };
- if(mode == YAbsolute) return { name, " y,$", strhex<4>(pa) };
+ if(mode == YAbsolute) return { name, " y,$", hex<4>(pa) };
if(mode == Y) return { name, " y" };
if(mode == AX) return { name, " a,x" };
- if(mode == YDirect) return { name, " y,$", strhex<2>(pl) };
- if(mode == YConstant) return { name, " y,#$", strhex<2>(pl) };
+ if(mode == YDirect) return { name, " y,$", hex<2>(pl) };
+ if(mode == YConstant) return { name, " y,#$", hex<2>(pl) };
if(mode == XSp) return { name, " x,sp" };
if(mode == YaX) return { name, " ya,x" };
if(mode == IXPA) return { name, " (x)+,a" };
if(mode == SpX) return { name, " sp,x" };
if(mode == AIXP) return { name, " a,(x)+" };
- if(mode == DirectA) return { name, " $", strhex<2>(pl), ",a" };
+ if(mode == DirectA) return { name, " $", hex<2>(pl), ",a" };
if(mode == IXA) return { name, " (x),a" };
- if(mode == IDirectXA) return { name, " ($", strhex<2>(pl), "+x),a" };
- if(mode == XConstant) return { name, " x,#$", strhex<2>(pl) };
- if(mode == AbsoluteX) return { name, " $", strhex<4>(pa), ",x" };
- if(mode == AbsoluteBitC) return { name, " $", strhex<4>(pa & 0x1fff), ":", pa >> 13, ",c" };
- if(mode == DirectY) return { name, " $", strhex<2>(pl), ",y" };
- if(mode == AbsoluteY) return { name, " $", strhex<4>(pa), ",y" };
+ if(mode == IDirectXA) return { name, " ($", hex<2>(pl), "+x),a" };
+ if(mode == XConstant) return { name, " x,#$", hex<2>(pl) };
+ if(mode == AbsoluteX) return { name, " $", hex<4>(pa), ",x" };
+ if(mode == AbsoluteBitC) return { name, " $", hex<4>(pa & 0x1fff), ":", pa >> 13, ",c" };
+ if(mode == DirectY) return { name, " $", hex<2>(pl), ",y" };
+ if(mode == AbsoluteY) return { name, " $", hex<4>(pa), ",y" };
if(mode == Ya) return { name, " ya" };
- if(mode == DirectXA) return { name, " $", strhex<2>(pl), "+x,a" };
- if(mode == AbsoluteXA) return { name, " $", strhex<4>(pa), "+x,a" };
- if(mode == AbsoluteYA) return { name, " $", strhex<4>(pa), "+y,a" };
- if(mode == IDirectYA) return { name, " ($", strhex<2>(pl), ")+y,a" };
- if(mode == DirectYX) return { name, " $", strhex<2>(pl), "+y,x" };
- if(mode == DirectYa) return { name, " $", strhex<2>(pl), ",ya" };
- if(mode == DirectXY) return { name, " $", strhex<2>(pl), "+x,y" };
+ if(mode == DirectXA) return { name, " $", hex<2>(pl), "+x,a" };
+ if(mode == AbsoluteXA) return { name, " $", hex<4>(pa), "+x,a" };
+ if(mode == AbsoluteYA) return { name, " $", hex<4>(pa), "+y,a" };
+ if(mode == IDirectYA) return { name, " ($", hex<2>(pl), ")+y,a" };
+ if(mode == DirectYX) return { name, " $", hex<2>(pl), "+y,x" };
+ if(mode == DirectYa) return { name, " $", hex<2>(pl), ",ya" };
+ if(mode == DirectXY) return { name, " $", hex<2>(pl), "+x,y" };
if(mode == AY) return { name, " a,y" };
- if(mode == DirectXRelative) return { name, " $", strhex<2>(pl), ",$", strhex<4>(pc + 3 + (int8_t)ph) };
- if(mode == XDirectY) return { name, " x,$", strhex<2>(pl), "+y" };
- if(mode == YDirectX) return { name, " y,$", strhex<2>(pl), "+x" };
+ if(mode == DirectXRelative) return { name, " $", hex<2>(pl), ",$", hex<4>(pc + 3 + (int8_t)ph) };
+ if(mode == XDirectY) return { name, " x,$", hex<2>(pl), "+y" };
+ if(mode == YDirectX) return { name, " y,$", hex<2>(pl), "+x" };
if(mode == YA) return { name, " y,a" };
- if(mode == YRelative) return { name, " y,$", strhex<4>(pc + 2 + (int8_t)pl) };
+ if(mode == YRelative) return { name, " y,$", hex<4>(pc + 2 + (int8_t)pl) };
return "";
}
@@ -569,67 +569,67 @@ inline string SNESSMP::disassemble(uint16_t pc, bool p, uint8_t opcode, uint8_t
if(mode == Implied) return name;
if(mode == TVector) return { name, " ", opcode >> 4 };
- if(mode == Direct) return { name, " $", strhex<3>(pdl) };
- if(mode == DirectRelative) return { name, " $", strhex<3>(pdl), ",$", strhex<4>(pc + 3 + (int8_t)ph) };
- if(mode == ADirect) return { name, " a,$", strhex<3>(pdl) };
- if(mode == AAbsolute) return { name, " a,$", strhex<4>(pa) };
+ if(mode == Direct) return { name, " $", hex<3>(pdl) };
+ if(mode == DirectRelative) return { name, " $", hex<3>(pdl), ",$", hex<4>(pc + 3 + (int8_t)ph) };
+ if(mode == ADirect) return { name, " a,$", hex<3>(pdl) };
+ if(mode == AAbsolute) return { name, " a,$", hex<4>(pa) };
if(mode == AIX) return { name, "a,(x)" };
- if(mode == AIDirectX) return { name, " a,($", strhex<3>(pdl), "+x)" };
- if(mode == AConstant) return { name, " a,#$", strhex<2>(pl) };
- if(mode == DirectDirect) return { name, " $", strhex<3>(pdh), ",$", strhex<3>(pdl) };
- if(mode == CAbsoluteBit) return { name, " c,$", strhex<4>(pa & 0x1fff), ":", pa >> 13 };
- if(mode == Absolute) return { name, " $", strhex<4>(pa) };
+ if(mode == AIDirectX) return { name, " a,($", hex<3>(pdl), "+x)" };
+ if(mode == AConstant) return { name, " a,#$", hex<2>(pl) };
+ if(mode == DirectDirect) return { name, " $", hex<3>(pdh), ",$", hex<3>(pdl) };
+ if(mode == CAbsoluteBit) return { name, " c,$", hex<4>(pa & 0x1fff), ":", pa >> 13 };
+ if(mode == Absolute) return { name, " $", hex<4>(pa) };
if(mode == P) return { name, " p" };
- if(mode == AbsoluteA) return { name, " $", strhex<4>(pa), ",a" };
- if(mode == Relative) return { name, " $", strhex<4>(pc + 2 + (int8_t)pl) };
- if(mode == ADirectX) return { name, " a,$", strhex<3>(pdl), "+x" };
- if(mode == AAbsoluteX) return { name, " a,$", strhex<4>(pa), "+x" };
- if(mode == AAbsoluteY) return { name, " a,$", strhex<4>(pa), "+y" };
- if(mode == AIDirectY) return { name, " a,($", strhex<3>(pdl), ")+y" };
- if(mode == DirectConstant) return { name, " $", strhex<3>(pdh), ",#$", strhex<2>(pl) };
+ if(mode == AbsoluteA) return { name, " $", hex<4>(pa), ",a" };
+ if(mode == Relative) return { name, " $", hex<4>(pc + 2 + (int8_t)pl) };
+ if(mode == ADirectX) return { name, " a,$", hex<3>(pdl), "+x" };
+ if(mode == AAbsoluteX) return { name, " a,$", hex<4>(pa), "+x" };
+ if(mode == AAbsoluteY) return { name, " a,$", hex<4>(pa), "+y" };
+ if(mode == AIDirectY) return { name, " a,($", hex<3>(pdl), ")+y" };
+ if(mode == DirectConstant) return { name, " $", hex<3>(pdh), ",#$", hex<2>(pl) };
if(mode == IXIY) return { name, " (x),(y)" };
- if(mode == DirectX) return { name, " $", strhex<3>(pdl), "+x" };
+ if(mode == DirectX) return { name, " $", hex<3>(pdl), "+x" };
if(mode == A) return { name, " a" };
if(mode == X) return { name, " x" };
- if(mode == XAbsolute) return { name, " x,$", strhex<4>(pa) };
- if(mode == IAbsoluteX) return { name, " ($", strhex<4>(pa), "+x)" };
- if(mode == CNAbsoluteBit) return { name, " c,!$", strhex<4>(pa & 0x1fff), ":", pa >> 13 };
- if(mode == XDirect) return { name, " x,$", strhex<3>(pdl) };
- if(mode == PVector) return { name, " $ff", strhex<2>(pl) };
- if(mode == YaDirect) return { name, " ya,$", strhex<3>(pdl) };
+ if(mode == XAbsolute) return { name, " x,$", hex<4>(pa) };
+ if(mode == IAbsoluteX) return { name, " ($", hex<4>(pa), "+x)" };
+ if(mode == CNAbsoluteBit) return { name, " c,!$", hex<4>(pa & 0x1fff), ":", pa >> 13 };
+ if(mode == XDirect) return { name, " x,$", hex<3>(pdl) };
+ if(mode == PVector) return { name, " $ff", hex<2>(pl) };
+ if(mode == YaDirect) return { name, " ya,$", hex<3>(pdl) };
if(mode == XA) return { name, " x,a" };
- if(mode == YAbsolute) return { name, " y,$", strhex<4>(pa) };
+ if(mode == YAbsolute) return { name, " y,$", hex<4>(pa) };
if(mode == Y) return { name, " y" };
if(mode == AX) return { name, " a,x" };
- if(mode == YDirect) return { name, " y,$", strhex<3>(pdl) };
- if(mode == YConstant) return { name, " y,#$", strhex<2>(pl) };
+ if(mode == YDirect) return { name, " y,$", hex<3>(pdl) };
+ if(mode == YConstant) return { name, " y,#$", hex<2>(pl) };
if(mode == XSp) return { name, " x,sp" };
if(mode == YaX) return { name, " ya,x" };
if(mode == IXPA) return { name, " (x)+,a" };
if(mode == SpX) return { name, " sp,x" };
if(mode == AIXP) return { name, " a,(x)+" };
- if(mode == DirectA) return { name, " $", strhex<3>(pdl), ",a" };
+ if(mode == DirectA) return { name, " $", hex<3>(pdl), ",a" };
if(mode == IXA) return { name, " (x),a" };
- if(mode == IDirectXA) return { name, " ($", strhex<3>(pdl), "+x),a" };
- if(mode == XConstant) return { name, " x,#$", strhex<2>(pl) };
- if(mode == AbsoluteX) return { name, " $", strhex<4>(pa), ",x" };
- if(mode == AbsoluteBitC) return { name, " $", strhex<4>(pa & 0x1fff), ":", pa >> 13, ",c" };
- if(mode == DirectY) return { name, " $", strhex<3>(pdl), ",y" };
- if(mode == AbsoluteY) return { name, " $", strhex<4>(pa), ",y" };
+ if(mode == IDirectXA) return { name, " ($", hex<3>(pdl), "+x),a" };
+ if(mode == XConstant) return { name, " x,#$", hex<2>(pl) };
+ if(mode == AbsoluteX) return { name, " $", hex<4>(pa), ",x" };
+ if(mode == AbsoluteBitC) return { name, " $", hex<4>(pa & 0x1fff), ":", pa >> 13, ",c" };
+ if(mode == DirectY) return { name, " $", hex<3>(pdl), ",y" };
+ if(mode == AbsoluteY) return { name, " $", hex<4>(pa), ",y" };
if(mode == Ya) return { name, " ya" };
- if(mode == DirectXA) return { name, " $", strhex<3>(pdl), "+x,a" };
- if(mode == AbsoluteXA) return { name, " $", strhex<4>(pa), "+x,a" };
- if(mode == AbsoluteYA) return { name, " $", strhex<4>(pa), "+y,a" };
- if(mode == IDirectYA) return { name, " ($", strhex<3>(pdl), ")+y,a" };
- if(mode == DirectYX) return { name, " $", strhex<3>(pdl), "+y,x" };
- if(mode == DirectYa) return { name, " $", strhex<3>(pdl), ",ya" };
- if(mode == DirectXY) return { name, " $", strhex<3>(pdl), "+x,y" };
+ if(mode == DirectXA) return { name, " $", hex<3>(pdl), "+x,a" };
+ if(mode == AbsoluteXA) return { name, " $", hex<4>(pa), "+x,a" };
+ if(mode == AbsoluteYA) return { name, " $", hex<4>(pa), "+y,a" };
+ if(mode == IDirectYA) return { name, " ($", hex<3>(pdl), ")+y,a" };
+ if(mode == DirectYX) return { name, " $", hex<3>(pdl), "+y,x" };
+ if(mode == DirectYa) return { name, " $", hex<3>(pdl), ",ya" };
+ if(mode == DirectXY) return { name, " $", hex<3>(pdl), "+x,y" };
if(mode == AY) return { name, " a,y" };
- if(mode == DirectXRelative) return { name, " $", strhex<3>(pdl), ",$", strhex<4>(pc + 3 + (int8_t)ph) };
- if(mode == XDirectY) return { name, " x,$", strhex<3>(pdl), "+y" };
- if(mode == YDirectX) return { name, " y,$", strhex<3>(pdl), "+x" };
+ if(mode == DirectXRelative) return { name, " $", hex<3>(pdl), ",$", hex<4>(pc + 3 + (int8_t)ph) };
+ if(mode == XDirectY) return { name, " x,$", hex<3>(pdl), "+y" };
+ if(mode == YDirectX) return { name, " y,$", hex<3>(pdl), "+x" };
if(mode == YA) return { name, " y,a" };
- if(mode == YRelative) return { name, " y,$", strhex<4>(pc + 2 + (int8_t)pl) };
+ if(mode == YRelative) return { name, " y,$", hex<4>(pc + 2 + (int8_t)pl) };
return "";
}
diff --git a/bsnes/nall/string/base.hpp b/bsnes/nall/string/base.hpp
index 77f15e17..f2e307c0 100755
--- a/bsnes/nall/string/base.hpp
+++ b/bsnes/nall/string/base.hpp
@@ -113,11 +113,11 @@ namespace nall {
inline char* strlower(char *str);
inline char* strupper(char *str);
inline char* strtr(char *dest, const char *before, const char *after);
- inline uintmax_t strhex (const char *str);
- inline intmax_t strsigned (const char *str);
- inline uintmax_t strunsigned(const char *str);
- inline uintmax_t strbin (const char *str);
- inline double strdouble (const char *str);
+ inline uintmax_t hex (const char *str);
+ inline intmax_t integer(const char *str);
+ inline uintmax_t decimal(const char *str);
+ inline uintmax_t binary (const char *str);
+ inline double fp (const char *str);
//math.hpp
inline bool strint (const char *str, int &result);
@@ -145,12 +145,12 @@ namespace nall {
inline unsigned strlcpy(string &dest, const char *src, unsigned length);
inline unsigned strlcat(string &dest, const char *src, unsigned length);
inline string substr(const char *src, unsigned start = 0, unsigned length = 0);
- template inline string strhex(uintmax_t value);
- template inline string strsigned(intmax_t value);
- template inline string strunsigned(uintmax_t value);
- template inline string strbin(uintmax_t value);
- inline unsigned strdouble(char *str, double value);
- inline string strdouble(double value);
+ template inline string hex(uintmax_t value);
+ template inline string integer(intmax_t value);
+ template inline string decimal(uintmax_t value);
+ template inline string binary(uintmax_t value);
+ inline unsigned fp(char *str, double value);
+ inline string fp(double value);
//variadic.hpp
template inline void print(Args&&... args);
diff --git a/bsnes/nall/string/cast.hpp b/bsnes/nall/string/cast.hpp
index 5b17c408..d8503106 100755
--- a/bsnes/nall/string/cast.hpp
+++ b/bsnes/nall/string/cast.hpp
@@ -5,9 +5,9 @@ namespace nall {
//this is needed, as C++0x does not support explicit template specialization inside classes
template<> inline string to_string (bool v) { return v ? "true" : "false"; }
-template<> inline string to_string (signed int v) { return strsigned(v); }
-template<> inline string to_string (unsigned int v) { return strunsigned(v); }
-template<> inline string to_string (double v) { return strdouble(v); }
+template<> inline string to_string (signed int v) { return integer(v); }
+template<> inline string to_string (unsigned int v) { return decimal(v); }
+template<> inline string to_string (double v) { return fp(v); }
template<> inline string to_string (char *v) { return v; }
template<> inline string to_string (const char *v) { return v; }
template<> inline string to_string (string v) { return v; }
diff --git a/bsnes/nall/string/convert.hpp b/bsnes/nall/string/convert.hpp
index 12a6c1ff..9040cb83 100755
--- a/bsnes/nall/string/convert.hpp
+++ b/bsnes/nall/string/convert.hpp
@@ -40,7 +40,7 @@ char* strtr(char *dest, const char *before, const char *after) {
return dest;
}
-uintmax_t strhex(const char *str) {
+uintmax_t hex(const char *str) {
if(!str) return 0;
uintmax_t result = 0;
@@ -60,7 +60,7 @@ uintmax_t strhex(const char *str) {
return result;
}
-intmax_t strsigned(const char *str) {
+intmax_t integer(const char *str) {
if(!str) return 0;
intmax_t result = 0;
bool negate = false;
@@ -81,7 +81,7 @@ intmax_t strsigned(const char *str) {
return !negate ? result : -result;
}
-uintmax_t strunsigned(const char *str) {
+uintmax_t decimal(const char *str) {
if(!str) return 0;
uintmax_t result = 0;
@@ -95,7 +95,7 @@ uintmax_t strunsigned(const char *str) {
return result;
}
-uintmax_t strbin(const char *str) {
+uintmax_t binary(const char *str) {
if(!str) return 0;
uintmax_t result = 0;
@@ -113,7 +113,7 @@ uintmax_t strbin(const char *str) {
return result;
}
-double strdouble(const char *str) {
+double fp(const char *str) {
if(!str) return 0.0;
bool negate = false;
diff --git a/bsnes/nall/string/core.hpp b/bsnes/nall/string/core.hpp
index bad29030..976ae9b3 100755
--- a/bsnes/nall/string/core.hpp
+++ b/bsnes/nall/string/core.hpp
@@ -26,9 +26,9 @@ string& string::append(const char *s) {
}
string& string::append(bool value) { append(value ? "true" : "false"); return *this; }
-string& string::append(signed int value) { append(strsigned(value)); return *this; }
-string& string::append(unsigned int value) { append(strunsigned(value)); return *this; }
-string& string::append(double value) { append(strdouble(value)); return *this; }
+string& string::append(signed int value) { append(integer(value)); return *this; }
+string& string::append(unsigned int value) { append(decimal(value)); return *this; }
+string& string::append(double value) { append(fp(value)); return *this; }
string::operator const char*() const {
return data;
diff --git a/bsnes/nall/string/utility.hpp b/bsnes/nall/string/utility.hpp
index d2bad881..779e6c7d 100755
--- a/bsnes/nall/string/utility.hpp
+++ b/bsnes/nall/string/utility.hpp
@@ -27,7 +27,7 @@ string substr(const char *src, unsigned start, unsigned length) {
/* arithmetic <> string */
-template string strhex(uintmax_t value) {
+template string hex(uintmax_t value) {
string output;
unsigned offset = 0;
@@ -51,7 +51,7 @@ template string strhex(uintmax_t value) {
return output;
}
-template string strsigned(intmax_t value) {
+template string integer(intmax_t value) {
string output;
unsigned offset = 0;
@@ -77,7 +77,7 @@ template string strsigned(intmax_t value) {
return output;
}
-template string strunsigned(uintmax_t value) {
+template string decimal(uintmax_t value) {
string output;
unsigned offset = 0;
@@ -99,7 +99,7 @@ template string strunsigned(uintmax_t value) {
return output;
}
-template string strbin(uintmax_t value) {
+template string binary(uintmax_t value) {
string output;
unsigned offset = 0;
@@ -124,7 +124,7 @@ template string strbin(uintmax_t value) {
//using sprintf is certainly not the most ideal method to convert
//a double to a string ... but attempting to parse a double by
//hand, digit-by-digit, results in subtle rounding errors.
-unsigned strdouble(char *str, double value) {
+unsigned fp(char *str, double value) {
char buffer[256];
sprintf(buffer, "%f", value);
@@ -145,10 +145,10 @@ unsigned strdouble(char *str, double value) {
return length + 1;
}
-string strdouble(double value) {
+string fp(double value) {
string temp;
- temp.reserve(strdouble(0, value));
- strdouble(temp(), value);
+ temp.reserve(fp(0, value));
+ fp(temp(), value);
return temp;
}
diff --git a/bsnes/phoenix/gtk/hexeditor.cpp b/bsnes/phoenix/gtk/hexeditor.cpp
index b8569820..3da8f3e1 100755
--- a/bsnes/phoenix/gtk/hexeditor.cpp
+++ b/bsnes/phoenix/gtk/hexeditor.cpp
@@ -80,7 +80,7 @@ void HexEditor::update() {
string output;
unsigned offset = hexEditor->offset;
for(unsigned row = 0; row < hexEditor->rows; row++) {
- output.append(strhex<8>(offset));
+ output.append(hex<8>(offset));
output.append(" ");
string hexdata;
@@ -88,7 +88,7 @@ void HexEditor::update() {
for(unsigned column = 0; column < hexEditor->columns; column++) {
if(offset < hexEditor->size) {
uint8_t data = onRead(offset++);
- hexdata.append(strhex<2>(data));
+ hexdata.append(hex<2>(data));
hexdata.append(" ");
char buffer[2] = { data >= 0x20 && data <= 0x7e ? (char)data : '.', 0 };
ansidata.append(buffer);
diff --git a/bsnes/phoenix/gtk/listbox.cpp b/bsnes/phoenix/gtk/listbox.cpp
index e851e6ba..3d390338 100755
--- a/bsnes/phoenix/gtk/listbox.cpp
+++ b/bsnes/phoenix/gtk/listbox.cpp
@@ -14,7 +14,7 @@ static void ListBox_change(ListBox *self) {
}
static void ListBox_tick(GtkCellRendererToggle *cell, gchar *path_string, ListBox *self) {
- unsigned index = strunsigned(path_string);
+ unsigned index = decimal(path_string);
self->setChecked(index, !self->checked(index));
if(self->onTick) self->onTick(index);
}
diff --git a/bsnes/snes/alt/ppu-compatibility/debugger/debugger.cpp b/bsnes/snes/alt/ppu-compatibility/debugger/debugger.cpp
index a67455e5..2a294c5d 100755
--- a/bsnes/snes/alt/ppu-compatibility/debugger/debugger.cpp
+++ b/bsnes/snes/alt/ppu-compatibility/debugger/debugger.cpp
@@ -47,8 +47,8 @@ bool PPUDebugger::property(unsigned id, string &name, string &value) {
}
//internal
- item("S-PPU1 MDR", string("0x", strhex<2>(regs.ppu1_mdr)));
- item("S-PPU2 MDR", string("0x", strhex<2>(regs.ppu2_mdr)));
+ item("S-PPU1 MDR", string("0x", hex<2>(regs.ppu1_mdr)));
+ item("S-PPU2 MDR", string("0x", hex<2>(regs.ppu2_mdr)));
//$2100
item("$2100", "");
@@ -59,11 +59,11 @@ bool PPUDebugger::property(unsigned id, string &name, string &value) {
item("$2101", "");
item("OAM Base Size", (unsigned)regs.oam_basesize);
item("OAM Name Select", (unsigned)regs.oam_nameselect);
- item("OAM Name Base Address", string("0x", strhex<4>(regs.oam_tdaddr)));
+ item("OAM Name Base Address", string("0x", hex<4>(regs.oam_tdaddr)));
//$2102-$2103
item("$2102-$2103", "");
- item("OAM Base Address", string("0x", strhex<4>(regs.oam_baseaddr)));
+ item("OAM Base Address", string("0x", hex<4>(regs.oam_baseaddr)));
item("OAM Priority", regs.oam_priority);
//$2105
@@ -87,33 +87,33 @@ bool PPUDebugger::property(unsigned id, string &name, string &value) {
//$2107
item("$2107", "");
- item("BG1 Screen Address", string("0x", strhex<4>(regs.bg_scaddr[BG1])));
+ item("BG1 Screen Address", string("0x", hex<4>(regs.bg_scaddr[BG1])));
item("BG1 Screen Size", screen_size[regs.bg_scsize[BG1]]);
//$2108
item("$2108", "");
- item("BG2 Screen Address", string("0x", strhex<4>(regs.bg_scaddr[BG2])));
+ item("BG2 Screen Address", string("0x", hex<4>(regs.bg_scaddr[BG2])));
item("BG2 Screen Size", screen_size[regs.bg_scsize[BG2]]);
//$2109
item("$2109", "");
- item("BG3 Screen Address", string("0x", strhex<4>(regs.bg_scaddr[BG3])));
+ item("BG3 Screen Address", string("0x", hex<4>(regs.bg_scaddr[BG3])));
item("BG3 Screen Size", screen_size[regs.bg_scsize[BG3]]);
//$210a
item("$210a", "");
- item("BG4 Screen Address", string("0x", strhex<4>(regs.bg_scaddr[BG4])));
+ item("BG4 Screen Address", string("0x", hex<4>(regs.bg_scaddr[BG4])));
item("BG4 Screen Size", screen_size[regs.bg_scsize[BG4]]);
//$210b
item("$210b", "");
- item("BG1 Name Base Address", string("0x", strhex<4>(regs.bg_tdaddr[BG1])));
- item("BG2 Name Base Address", string("0x", strhex<4>(regs.bg_tdaddr[BG2])));
+ item("BG1 Name Base Address", string("0x", hex<4>(regs.bg_tdaddr[BG1])));
+ item("BG2 Name Base Address", string("0x", hex<4>(regs.bg_tdaddr[BG2])));
//$210c
item("$210c", "");
- item("BG3 Name Base Address", string("0x", strhex<4>(regs.bg_tdaddr[BG3])));
- item("BG4 Name Base Address", string("0x", strhex<4>(regs.bg_tdaddr[BG4])));
+ item("BG3 Name Base Address", string("0x", hex<4>(regs.bg_tdaddr[BG3])));
+ item("BG4 Name Base Address", string("0x", hex<4>(regs.bg_tdaddr[BG4])));
//$210d
item("$210d", "");
@@ -157,7 +157,7 @@ bool PPUDebugger::property(unsigned id, string &name, string &value) {
//$2116-$2117
item("$2116-$2117", "");
- item("VRAM Address", string("0x", strhex<4>(regs.vram_addr)));
+ item("VRAM Address", string("0x", hex<4>(regs.vram_addr)));
//$211a
item("$211a", "");
@@ -191,7 +191,7 @@ bool PPUDebugger::property(unsigned id, string &name, string &value) {
//$2121
item("$2121", "");
- item("CGRAM Address", string("0x", strhex<4>(regs.cgram_addr)));
+ item("CGRAM Address", string("0x", hex<4>(regs.cgram_addr)));
//$2123
item("$2123", "");
diff --git a/bsnes/snes/cartridge/cartridge.cpp b/bsnes/snes/cartridge/cartridge.cpp
index 3e177129..dae1f05e 100755
--- a/bsnes/snes/cartridge/cartridge.cpp
+++ b/bsnes/snes/cartridge/cartridge.cpp
@@ -49,6 +49,7 @@ void Cartridge::load(Mode cartridge_mode, const lstring &xml_list) {
has_serial = false;
parse_xml(xml_list);
+//print(xml_list[0], "\n");
if(ram_size > 0) {
memory::cartram.map(allocate(ram_size, 0xff), ram_size);
@@ -104,7 +105,7 @@ void Cartridge::load(Mode cartridge_mode, const lstring &xml_list) {
sha256_hash(&sha, shahash);
string hash;
- foreach(n, shahash) hash << strhex<2>(n);
+ foreach(n, shahash) hash << hex<2>(n);
sha256 = hash;
bus.load_cart();
diff --git a/bsnes/snes/cartridge/xml.cpp b/bsnes/snes/cartridge/xml.cpp
index d906b3e2..6adb98cd 100755
--- a/bsnes/snes/cartridge/xml.cpp
+++ b/bsnes/snes/cartridge/xml.cpp
@@ -75,7 +75,7 @@ void Cartridge::parse_xml_gameboy(const char *data) {
if(leaf.name == "ram") {
foreach(attr, leaf.attribute) {
if(attr.name == "size") {
- supergameboy_ram_size = strhex(attr.content);
+ supergameboy_ram_size = hex(attr.content);
}
}
}
@@ -91,8 +91,8 @@ void Cartridge::xml_parse_rom(xml_element &root) {
foreach(attr, leaf.attribute) {
if(attr.name == "address") xml_parse_address(m, attr.content);
if(attr.name == "mode") xml_parse_mode(m, attr.content);
- if(attr.name == "offset") m.offset = strhex(attr.content);
- if(attr.name == "size") m.size = strhex(attr.content);
+ if(attr.name == "offset") m.offset = hex(attr.content);
+ if(attr.name == "size") m.size = hex(attr.content);
}
mapping.append(m);
}
@@ -101,7 +101,7 @@ void Cartridge::xml_parse_rom(xml_element &root) {
void Cartridge::xml_parse_ram(xml_element &root) {
foreach(attr, root.attribute) {
- if(attr.name == "size") ram_size = strhex(attr.content);
+ if(attr.name == "size") ram_size = hex(attr.content);
}
foreach(leaf, root.element) {
@@ -110,8 +110,8 @@ void Cartridge::xml_parse_ram(xml_element &root) {
foreach(attr, leaf.attribute) {
if(attr.name == "address") xml_parse_address(m, attr.content);
if(attr.name == "mode") xml_parse_mode(m, attr.content);
- if(attr.name == "offset") m.offset = strhex(attr.content);
- if(attr.name == "size") m.size = strhex(attr.content);
+ if(attr.name == "offset") m.offset = hex(attr.content);
+ if(attr.name == "size") m.size = hex(attr.content);
}
mapping.append(m);
}
@@ -129,15 +129,15 @@ void Cartridge::xml_parse_superfx(xml_element &root) {
foreach(attr, leaf.attribute) {
if(attr.name == "address") xml_parse_address(m, attr.content);
if(attr.name == "mode") xml_parse_mode(m, attr.content);
- if(attr.name == "offset") m.offset = strhex(attr.content);
- if(attr.name == "size") m.size = strhex(attr.content);
+ if(attr.name == "offset") m.offset = hex(attr.content);
+ if(attr.name == "size") m.size = hex(attr.content);
}
mapping.append(m);
}
}
} else if(node.name == "ram") {
foreach(attr, node.attribute) {
- if(attr.name == "size") ram_size = strhex(attr.content);
+ if(attr.name == "size") ram_size = hex(attr.content);
}
foreach(leaf, node.element) {
@@ -146,8 +146,8 @@ void Cartridge::xml_parse_superfx(xml_element &root) {
foreach(attr, leaf.attribute) {
if(attr.name == "address") xml_parse_address(m, attr.content);
if(attr.name == "mode") xml_parse_mode(m, attr.content);
- if(attr.name == "offset") m.offset = strhex(attr.content);
- if(attr.name == "size") m.size = strhex(attr.content);
+ if(attr.name == "offset") m.offset = hex(attr.content);
+ if(attr.name == "size") m.size = hex(attr.content);
}
mapping.append(m);
}
@@ -177,8 +177,8 @@ void Cartridge::xml_parse_sa1(xml_element &root) {
foreach(attr, leaf.attribute) {
if(attr.name == "address") xml_parse_address(m, attr.content);
if(attr.name == "mode") xml_parse_mode(m, attr.content);
- if(attr.name == "offset") m.offset = strhex(attr.content);
- if(attr.name == "size") m.size = strhex(attr.content);
+ if(attr.name == "offset") m.offset = hex(attr.content);
+ if(attr.name == "size") m.size = hex(attr.content);
}
mapping.append(m);
}
@@ -190,15 +190,15 @@ void Cartridge::xml_parse_sa1(xml_element &root) {
foreach(attr, leaf.attribute) {
if(attr.name == "address") xml_parse_address(m, attr.content);
if(attr.name == "mode") xml_parse_mode(m, attr.content);
- if(attr.name == "offset") m.offset = strhex(attr.content);
- if(attr.name == "size") m.size = strhex(attr.content);
+ if(attr.name == "offset") m.offset = hex(attr.content);
+ if(attr.name == "size") m.size = hex(attr.content);
}
mapping.append(m);
}
}
} else if(node.name == "bwram") {
foreach(attr, node.attribute) {
- if(attr.name == "size") ram_size = strhex(attr.content);
+ if(attr.name == "size") ram_size = hex(attr.content);
}
foreach(leaf, node.element) {
@@ -207,8 +207,8 @@ void Cartridge::xml_parse_sa1(xml_element &root) {
foreach(attr, leaf.attribute) {
if(attr.name == "address") xml_parse_address(m, attr.content);
if(attr.name == "mode") xml_parse_mode(m, attr.content);
- if(attr.name == "offset") m.offset = strhex(attr.content);
- if(attr.name == "size") m.size = strhex(attr.content);
+ if(attr.name == "offset") m.offset = hex(attr.content);
+ if(attr.name == "size") m.size = hex(attr.content);
}
mapping.append(m);
}
@@ -281,8 +281,8 @@ void Cartridge::xml_parse_bsx(xml_element &root) {
foreach(attr, leaf.attribute) {
if(attr.name == "address") xml_parse_address(m, attr.content);
if(attr.name == "mode") xml_parse_mode(m, attr.content);
- if(attr.name == "offset") m.offset = strhex(attr.content);
- if(attr.name == "size") m.size = strhex(attr.content);
+ if(attr.name == "offset") m.offset = hex(attr.content);
+ if(attr.name == "size") m.size = hex(attr.content);
}
mapping.append(m);
}
@@ -322,8 +322,8 @@ void Cartridge::xml_parse_sufamiturbo(xml_element &root) {
foreach(attr, leaf.attribute) {
if(attr.name == "address") xml_parse_address(m, attr.content);
if(attr.name == "mode") xml_parse_mode(m, attr.content);
- if(attr.name == "offset") m.offset = strhex(attr.content);
- if(attr.name == "size") m.size = strhex(attr.content);
+ if(attr.name == "offset") m.offset = hex(attr.content);
+ if(attr.name == "size") m.size = hex(attr.content);
}
if(m.memory->size() > 0) mapping.append(m);
}
@@ -335,8 +335,8 @@ void Cartridge::xml_parse_sufamiturbo(xml_element &root) {
foreach(attr, leaf.attribute) {
if(attr.name == "address") xml_parse_address(m, attr.content);
if(attr.name == "mode") xml_parse_mode(m, attr.content);
- if(attr.name == "offset") m.offset = strhex(attr.content);
- if(attr.name == "size") m.size = strhex(attr.content);
+ if(attr.name == "offset") m.offset = hex(attr.content);
+ if(attr.name == "size") m.size = hex(attr.content);
}
if(m.memory->size() > 0) mapping.append(m);
}
@@ -438,7 +438,7 @@ void Cartridge::xml_parse_spc7110(xml_element &root) {
Mapping m(spc7110mcu);
foreach(attr, leaf.attribute) {
if(attr.name == "address") xml_parse_address(m, attr.content);
- if(attr.name == "offset") spc7110_data_rom_offset = strhex(attr.content);
+ if(attr.name == "offset") spc7110_data_rom_offset = hex(attr.content);
}
mapping.append(m);
}
@@ -455,7 +455,7 @@ void Cartridge::xml_parse_spc7110(xml_element &root) {
}
} else if(node.name == "ram") {
foreach(attr, node.attribute) {
- if(attr.name == "size") ram_size = strhex(attr.content);
+ if(attr.name == "size") ram_size = hex(attr.content);
}
foreach(leaf, node.element) {
@@ -464,8 +464,8 @@ void Cartridge::xml_parse_spc7110(xml_element &root) {
foreach(attr, leaf.attribute) {
if(attr.name == "address") xml_parse_address(m, attr.content);
if(attr.name == "mode") xml_parse_mode(m, attr.content);
- if(attr.name == "offset") m.offset = strhex(attr.content);
- if(attr.name == "size") m.size = strhex(attr.content);
+ if(attr.name == "offset") m.offset = hex(attr.content);
+ if(attr.name == "size") m.size = hex(attr.content);
}
mapping.append(m);
}
@@ -662,20 +662,20 @@ void Cartridge::xml_parse_address(Mapping &m, const string &data) {
lstring subpart;
subpart.split("-", part[0]);
if(subpart.size() == 1) {
- m.banklo = strhex(subpart[0]);
+ m.banklo = hex(subpart[0]);
m.bankhi = m.banklo;
} else if(subpart.size() == 2) {
- m.banklo = strhex(subpart[0]);
- m.bankhi = strhex(subpart[1]);
+ m.banklo = hex(subpart[0]);
+ m.bankhi = hex(subpart[1]);
}
subpart.split("-", part[1]);
if(subpart.size() == 1) {
- m.addrlo = strhex(subpart[0]);
+ m.addrlo = hex(subpart[0]);
m.addrhi = m.addrlo;
} else if(subpart.size() == 2) {
- m.addrlo = strhex(subpart[0]);
- m.addrhi = strhex(subpart[1]);
+ m.addrlo = hex(subpart[0]);
+ m.addrhi = hex(subpart[1]);
}
}
diff --git a/bsnes/snes/cheat/cheat.cpp b/bsnes/snes/cheat/cheat.cpp
index c97e9a96..40fdf7cd 100755
--- a/bsnes/snes/cheat/cheat.cpp
+++ b/bsnes/snes/cheat/cheat.cpp
@@ -84,7 +84,7 @@ bool Cheat::decode(const char *s, unsigned &addr, uint8 &data, Type &type) {
for(unsigned i = 0; i < 8; i++) if(!ischr(t[i])) return false;
type = Type::ProActionReplay;
- unsigned r = strhex((const char*)t);
+ unsigned r = hex((const char*)t);
addr = r >> 8;
data = r & 0xff;
return true;
@@ -96,7 +96,7 @@ bool Cheat::decode(const char *s, unsigned &addr, uint8 &data, Type &type) {
type = Type::GameGenie;
t.transform("df4709156bc8a23e", "0123456789abcdef");
- unsigned r = strhex((const char*)t);
+ unsigned r = hex((const char*)t);
//8421 8421 8421 8421 8421 8421
//abcd efgh ijkl mnop qrst uvwx
//ijkl qrst opab cduv wxef ghmn
@@ -125,7 +125,7 @@ bool Cheat::encode(string &s, unsigned addr, uint8 data, Type type) {
char t[16];
if(type == Type::ProActionReplay) {
- s = string(strhex<6>(addr), strhex<2>(data));
+ s = string(hex<6>(addr), hex<2>(data));
return true;
} else if(type == Type::GameGenie) {
unsigned r = addr;
@@ -141,7 +141,7 @@ bool Cheat::encode(string &s, unsigned addr, uint8 data, Type type) {
| (!!(r & 0x080000) << 5) | (!!(r & 0x040000) << 4)
| (!!(r & 0x020000) << 3) | (!!(r & 0x010000) << 2)
| (!!(r & 0x000800) << 1) | (!!(r & 0x000400) << 0);
- s = string(strhex<2>(data), strhex<2>(addr >> 16), "-", strhex<4>(addr & 0xffff));
+ s = string(hex<2>(data), hex<2>(addr >> 16), "-", hex<4>(addr & 0xffff));
s.transform("0123456789abcdef", "df4709156bc8a23e");
return true;
} else {
diff --git a/bsnes/snes/chip/upd77c25/disassembler.cpp b/bsnes/snes/chip/upd77c25/disassembler.cpp
index ad95ab9b..009bb2b1 100755
--- a/bsnes/snes/chip/upd77c25/disassembler.cpp
+++ b/bsnes/snes/chip/upd77c25/disassembler.cpp
@@ -1,5 +1,5 @@
string UPD77C25::disassemble(uint11 ip) {
- string output = { strhex<3>(ip), " " };
+ string output = { hex<3>(ip), " " };
uint24 opcode = programROM[ip];
uint2 type = opcode >> 22;
@@ -171,7 +171,7 @@ string UPD77C25::disassemble(uint11 ip) {
default: output << "?????? "; break;
}
- output << "$" << strhex<3>(na);
+ output << "$" << hex<3>(na);
}
if(type == 3) { //LD
@@ -179,7 +179,7 @@ string UPD77C25::disassemble(uint11 ip) {
uint16 id = opcode >> 6;
uint4 dst = opcode >> 0;
- output << "$" << strhex<4>(id) << ",";
+ output << "$" << hex<4>(id) << ",";
switch(dst) {
case 0: output << "non"; break;
diff --git a/bsnes/snes/cpu/debugger/debugger.cpp b/bsnes/snes/cpu/debugger/debugger.cpp
index ccd55447..84b8142d 100755
--- a/bsnes/snes/cpu/debugger/debugger.cpp
+++ b/bsnes/snes/cpu/debugger/debugger.cpp
@@ -56,11 +56,11 @@ bool CPUDebugger::property(unsigned id, string &name, string &value) {
}
//internal
- item("S-CPU MDR", string("0x", strhex<2>(regs.mdr)));
+ item("S-CPU MDR", string("0x", hex<2>(regs.mdr)));
//$2181-2183
item("$2181-$2183", "");
- item("WRAM Address", string("0x", strhex<6>(status.wram_addr)));
+ item("WRAM Address", string("0x", hex<6>(status.wram_addr)));
//$4016
item("$4016", "");
@@ -75,45 +75,45 @@ bool CPUDebugger::property(unsigned id, string &name, string &value) {
//$4201
item("$4201", "");
- item("PIO", string("0x", strhex<2>(status.pio)));
+ item("PIO", string("0x", hex<2>(status.pio)));
//$4202
item("$4202", "");
- item("Multiplicand", string("0x", strhex<2>(status.wrmpya)));
+ item("Multiplicand", string("0x", hex<2>(status.wrmpya)));
//$4203
item("$4203", "");
- item("Multiplier", string("0x", strhex<2>(status.wrmpyb)));
+ item("Multiplier", string("0x", hex<2>(status.wrmpyb)));
//$4204-$4205
item("$4204-$4205", "");
- item("Dividend", string("0x", strhex<4>(status.wrdiva)));
+ item("Dividend", string("0x", hex<4>(status.wrdiva)));
//$4206
item("$4206", "");
- item("Divisor", string("0x", strhex<2>(status.wrdivb)));
+ item("Divisor", string("0x", hex<2>(status.wrdivb)));
//$4207-$4208
item("$4207-$4208", "");
- item("H-Time", string("0x", strhex<4>(status.hirq_pos)));
+ item("H-Time", string("0x", hex<4>(status.hirq_pos)));
//$4209-$420a
item("$4209-$420a", "");
- item("V-Time", string("0x", strhex<4>(status.virq_pos)));
+ item("V-Time", string("0x", hex<4>(status.virq_pos)));
//$420b
unsigned dma_enable = 0;
for(unsigned n = 0; n < 8; n++) dma_enable |= channel[n].dma_enabled << n;
item("$420b", "");
- item("DMA Enable", string("0x", strhex<2>(dma_enable)));
+ item("DMA Enable", string("0x", hex<2>(dma_enable)));
//$420c
unsigned hdma_enable = 0;
for(unsigned n = 0; n < 8; n++) hdma_enable |= channel[n].hdma_enabled << n;
item("$420c", "");
- item("HDMA Enable", string("0x", strhex<2>(hdma_enable)));
+ item("HDMA Enable", string("0x", hex<2>(hdma_enable)));
//$420d
item("$420d", "");
@@ -130,25 +130,25 @@ bool CPUDebugger::property(unsigned id, string &name, string &value) {
item("Transfer Mode", (unsigned)channel[i].transfer_mode);
//$43x1
- item("B-Bus Address", string("0x", strhex<4>(channel[i].dest_addr)));
+ item("B-Bus Address", string("0x", hex<4>(channel[i].dest_addr)));
//$43x2-$43x3
- item("A-Bus Address", string("0x", strhex<4>(channel[i].source_addr)));
+ item("A-Bus Address", string("0x", hex<4>(channel[i].source_addr)));
//$43x4
- item("A-Bus Bank", string("0x", strhex<2>(channel[i].source_bank)));
+ item("A-Bus Bank", string("0x", hex<2>(channel[i].source_bank)));
//$43x5-$43x6
- item("Transfer Size / Indirect Address", string("0x", strhex<4>(channel[i].transfer_size)));
+ item("Transfer Size / Indirect Address", string("0x", hex<4>(channel[i].transfer_size)));
//$43x7
- item("Indirect Bank", string("0x", strhex<2>(channel[i].indirect_bank)));
+ item("Indirect Bank", string("0x", hex<2>(channel[i].indirect_bank)));
//$43x8-$43x9
- item("Table Address", string("0x", strhex<4>(channel[i].hdma_addr)));
+ item("Table Address", string("0x", hex<4>(channel[i].hdma_addr)));
//$43xa
- item("Line Counter", string("0x", strhex<2>(channel[i].line_counter)));
+ item("Line Counter", string("0x", hex<2>(channel[i].line_counter)));
}
#undef item
diff --git a/bsnes/snes/smp/debugger/debugger.cpp b/bsnes/snes/smp/debugger/debugger.cpp
index d7ef7f8a..0b08a51c 100755
--- a/bsnes/snes/smp/debugger/debugger.cpp
+++ b/bsnes/snes/smp/debugger/debugger.cpp
@@ -68,7 +68,7 @@ bool SMPDebugger::property(unsigned id, string &name, string &value) {
//$00f2
item("$00f2", "");
- item("DSP Address", string("0x", strhex<2>(status.dsp_addr)));
+ item("DSP Address", string("0x", hex<2>(status.dsp_addr)));
#undef item
return false;
diff --git a/bsnes/snes/snes.hpp b/bsnes/snes/snes.hpp
index cf7a40b2..da732909 100755
--- a/bsnes/snes/snes.hpp
+++ b/bsnes/snes/snes.hpp
@@ -1,12 +1,12 @@
namespace SNES {
namespace Info {
static const char Name[] = "bsnes";
- static const char Version[] = "072.11";
+ static const char Version[] = "072.12";
static const unsigned SerializerVersion = 14;
}
}
-//#define DEBUGGER
+#define DEBUGGER
#define CHEAT_SYSTEM
#include
diff --git a/bsnes/ui-phoenix/debugger/cpu/debugger.cpp b/bsnes/ui-phoenix/debugger/cpu/debugger.cpp
index 601a4d99..1ea968d4 100755
--- a/bsnes/ui-phoenix/debugger/cpu/debugger.cpp
+++ b/bsnes/ui-phoenix/debugger/cpu/debugger.cpp
@@ -75,7 +75,7 @@ void CPUDebugger::refreshDisassembly() {
buffer.append("...\n");
} else {
unsigned addr = offset[n];
- buffer.append(strhex<6>(addr));
+ buffer.append(hex<6>(addr));
buffer.append(" ");
string text = SNESCPU::disassemble(
addr, usage[addr] & 2, usage[addr] & 1,
diff --git a/bsnes/ui-phoenix/debugger/smp/debugger.cpp b/bsnes/ui-phoenix/debugger/smp/debugger.cpp
index 5f6241a6..dc162846 100755
--- a/bsnes/ui-phoenix/debugger/smp/debugger.cpp
+++ b/bsnes/ui-phoenix/debugger/smp/debugger.cpp
@@ -75,7 +75,7 @@ void SMPDebugger::refreshDisassembly() {
buffer.append("...\n");
} else {
uint16_t addr = offset[n];
- buffer.append(strhex<4>(addr));
+ buffer.append(hex<4>(addr));
buffer.append(" ");
string text = SNESSMP::disassemble(
addr, read(addr + 0), read(addr + 1), read(addr + 2)
diff --git a/bsnes/ui-phoenix/debugger/tools/breakpoint-editor.cpp b/bsnes/ui-phoenix/debugger/tools/breakpoint-editor.cpp
index 071550d5..04d1f9dc 100755
--- a/bsnes/ui-phoenix/debugger/tools/breakpoint-editor.cpp
+++ b/bsnes/ui-phoenix/debugger/tools/breakpoint-editor.cpp
@@ -37,8 +37,8 @@ void BreakpointEditor::toggleBreakpoint(unsigned n) {
SNES::debugger.breakpoint[n].enabled = false;
} else {
SNES::debugger.breakpoint[n].enabled = true;
- SNES::debugger.breakpoint[n].addr = strhex(addressBox[n].text());
- SNES::debugger.breakpoint[n].data = strhex(valueBox[n].text());
+ SNES::debugger.breakpoint[n].addr = hex(addressBox[n].text());
+ SNES::debugger.breakpoint[n].data = hex(valueBox[n].text());
if(valueBox[n].text() == "") SNES::debugger.breakpoint[n].data = -1; //break on any value
SNES::debugger.breakpoint[n].mode = (SNES::Debugger::Breakpoint::Mode)typeBox[n].selection();
SNES::debugger.breakpoint[n].source = (SNES::Debugger::Breakpoint::Source)sourceBox[n].selection();
diff --git a/bsnes/ui-phoenix/debugger/tools/memory-editor.cpp b/bsnes/ui-phoenix/debugger/tools/memory-editor.cpp
index 132fe13f..d4009e70 100755
--- a/bsnes/ui-phoenix/debugger/tools/memory-editor.cpp
+++ b/bsnes/ui-phoenix/debugger/tools/memory-editor.cpp
@@ -42,7 +42,7 @@ void MemoryEditor::create() {
};
gotoBox.onChange = []() {
- unsigned addr = strhex(memoryEditor.gotoBox.text());
+ unsigned addr = hex(memoryEditor.gotoBox.text());
memoryEditor.editor.setOffset(addr % memoryEditor.size);
memoryEditor.editor.update();
};
diff --git a/bsnes/ui-phoenix/main.cpp b/bsnes/ui-phoenix/main.cpp
index 09bb4b42..938be0ca 100755
--- a/bsnes/ui-phoenix/main.cpp
+++ b/bsnes/ui-phoenix/main.cpp
@@ -151,7 +151,7 @@ void Application::loadGeometry() {
lstring position;
position.split(",", window->position);
Geometry geom = window->geometry();
- window->setGeometry(strunsigned(position[0]), strunsigned(position[1]), geom.width, geom.height);
+ window->setGeometry(decimal(position[0]), decimal(position[1]), geom.width, geom.height);
}
}
diff --git a/bsnes/ui-phoenix/tools/cheat-editor.cpp b/bsnes/ui-phoenix/tools/cheat-editor.cpp
index f2a2c4fd..a1ca04f2 100755
--- a/bsnes/ui-phoenix/tools/cheat-editor.cpp
+++ b/bsnes/ui-phoenix/tools/cheat-editor.cpp
@@ -5,7 +5,7 @@ void CheatEditor::load(string filename) {
cheatList.reset();
for(unsigned i = 0; i < 128; i++) {
cheatList.addItem("");
- cheatText[i][CheatSlot] = strunsigned<3, ' '>(i + 1);
+ cheatText[i][CheatSlot] = decimal<3, ' '>(i + 1);
cheatText[i][CheatCode] = "";
cheatText[i][CheatDesc] = "";
}
diff --git a/bsnes/ui-phoenix/tools/state-manager.cpp b/bsnes/ui-phoenix/tools/state-manager.cpp
index 07f2f317..d9942063 100755
--- a/bsnes/ui-phoenix/tools/state-manager.cpp
+++ b/bsnes/ui-phoenix/tools/state-manager.cpp
@@ -41,7 +41,7 @@ void StateManager::synchronize() {
void StateManager::refresh() {
for(unsigned i = 0; i < 32; i++) {
stateList.setItem(i, {
- strunsigned<2, ' '>(i + 1), "\t",
+ decimal<2, ' '>(i + 1), "\t",
slotLoadDescription(i)
});
}
diff --git a/bsnes/ui-qt/debugger/tools/breakpoint.cpp b/bsnes/ui-qt/debugger/tools/breakpoint.cpp
index 27e7a5ec..94ec117b 100755
--- a/bsnes/ui-qt/debugger/tools/breakpoint.cpp
+++ b/bsnes/ui-qt/debugger/tools/breakpoint.cpp
@@ -40,8 +40,8 @@ void BreakpointItem::toggle() {
if(state) {
SNES::debugger.breakpoint[id].enabled = true;
- SNES::debugger.breakpoint[id].addr = strhex(addr->text().toUtf8().data()) & 0xffffff;
- SNES::debugger.breakpoint[id].data = strhex(data->text().toUtf8().data()) & 0xff;
+ SNES::debugger.breakpoint[id].addr = hex(addr->text().toUtf8().data()) & 0xffffff;
+ SNES::debugger.breakpoint[id].data = hex(data->text().toUtf8().data()) & 0xff;
if(data->text().length() == 0) SNES::debugger.breakpoint[id].data = -1;
SNES::debugger.breakpoint[id].mode = (SNES::Debugger::Breakpoint::Mode)mode->currentIndex();
SNES::debugger.breakpoint[id].source = (SNES::Debugger::Breakpoint::Source)source->currentIndex();
diff --git a/bsnes/ui-qt/debugger/tools/memory.cpp b/bsnes/ui-qt/debugger/tools/memory.cpp
index a4df84a8..ac0c55fc 100755
--- a/bsnes/ui-qt/debugger/tools/memory.cpp
+++ b/bsnes/ui-qt/debugger/tools/memory.cpp
@@ -99,7 +99,7 @@ void MemoryEditor::sourceChanged(int index) {
case 4: memorySource = SNES::Debugger::MemorySource::CGRAM; editor->setSize(512); break;
}
- editor->setOffset(strhex(addr->text().toUtf8().data()));
+ editor->setOffset(hex(addr->text().toUtf8().data()));
editor->refresh();
}
@@ -112,7 +112,7 @@ void MemoryEditor::refresh() {
}
void MemoryEditor::updateOffset() {
- editor->setOffset(strhex(addr->text().toUtf8().data()));
+ editor->setOffset(hex(addr->text().toUtf8().data()));
refresh();
}
diff --git a/bsnes/ui-qt/tools/cheateditor.cpp b/bsnes/ui-qt/tools/cheateditor.cpp
index 07a5301f..93a461fc 100755
--- a/bsnes/ui-qt/tools/cheateditor.cpp
+++ b/bsnes/ui-qt/tools/cheateditor.cpp
@@ -110,7 +110,7 @@ void CheatEditorWindow::load(const char *filename) {
auto item = new QTreeWidgetItem(list);
item->setData(0, Qt::UserRole, QVariant(i));
- item->setText(0, strunsigned<3, ' '>(i + 1));
+ item->setText(0, decimal<3, ' '>(i + 1));
item->setCheckState(0, part[0] == "enabled" ? Qt::Checked : Qt::Unchecked);
item->setText(1, part[1]);
item->setText(2, part[2]);
diff --git a/bsnes/ui-qt/tools/cheatfinder.cpp b/bsnes/ui-qt/tools/cheatfinder.cpp
index 45165630..a259a4bd 100755
--- a/bsnes/ui-qt/tools/cheatfinder.cpp
+++ b/bsnes/ui-qt/tools/cheatfinder.cpp
@@ -143,9 +143,9 @@ void CheatFinderWindow::searchMemory() {
string text = valueEdit->text().toUtf8().constData();
//auto-detect input data type
- if(strbegin(text, "0x")) data = strhex((const char*)text + 2);
- else if(strbegin(text, "-")) data = strsigned(text);
- else data = strunsigned(text);
+ if(strbegin(text, "0x")) data = hex((const char*)text + 2);
+ else if(strbegin(text, "-")) data = integer(text);
+ else data = decimal(text);
if(addrList.size() == 0) {
//search for the first time: enqueue all possible values so they are all searched