mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-02-23 14:42:33 +01:00
byuu says: This updates higan to use the new Markup::Node changes. This is a really big change, and one slight typo anywhere could break certain classes of games from playing. I don't have ananke hooked up again yet, so I don't have the ability to test this much. If anyone with some v094 game folders wouldn't mind testing, I'd help out a great deal. I'm most concerned about testing one of each SNES special chip game. Most notably, systems like the SA-1, HitachiDSP and NEC-DSP were using the fancier lookups, eg node["rom[0]/name"], which I had to convert to a rather ugly node["rom"].at(0)["name"], which I'm fairly confident won't work. I'm going to blame that on the fumes from the shelves I just stained >.> Might work with node.find("rom[0]/name")(0) though ...? But so ugly ... ugh. That aside, this WIP adds the accuracy-PPU inlining, so the accuracy profile should run around 7.5% faster than before.
37 lines
1.1 KiB
C++
37 lines
1.1 KiB
C++
#ifndef NALL_DECODE_URL_HPP
|
|
#define NALL_DECODE_URL_HPP
|
|
|
|
namespace nall { namespace Decode {
|
|
|
|
//returns empty string on malformed content
|
|
inline auto URL(const string& input) -> string {
|
|
string output;
|
|
for(unsigned n = 0; n < input.size();) {
|
|
char c = input[n];
|
|
if(c >= 'A' && c <= 'Z') { output.append(c); n++; continue; }
|
|
if(c >= 'a' && c <= 'z') { output.append(c); n++; continue; }
|
|
if(c >= '0' && c <= '9') { output.append(c); n++; continue; }
|
|
if(c == '-' || c == '_' || c == '.' || c == '~') { output.append(c); n++; continue; }
|
|
if(c == '+') { output.append(' '); n++; continue; }
|
|
if(c != '%' || n + 2 >= input.size()) return "";
|
|
char hi = input[n + 1];
|
|
char lo = input[n + 2];
|
|
if(hi >= '0' && hi <= '9') hi -= '0';
|
|
else if(hi >= 'A' && hi <= 'F') hi -= 'A' - 10;
|
|
else if(hi >= 'a' && hi <= 'f') hi -= 'a' - 10;
|
|
else return "";
|
|
if(lo >= '0' && lo <= '9') lo -= '0';
|
|
else if(lo >= 'A' && lo <= 'F') lo -= 'A' - 10;
|
|
else if(lo >= 'a' && lo <= 'f') lo -= 'a' - 10;
|
|
else return "";
|
|
char byte = hi * 16 + lo;
|
|
output.append(byte);
|
|
n += 3;
|
|
}
|
|
return output;
|
|
}
|
|
|
|
}}
|
|
|
|
#endif
|