mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-30 15:39:48 +02:00
Update to v101r19 release.
byuu says: Changelog: - added \~130 new PAL games to icarus (courtesy of Smarthuman and aquaman) - added all three Korean-localized games to icarus - sfc: removed SuperDisc emulation (it was going nowhere) - sfc: fixed MSU1 regression where the play/repeat flags were not being cleared on track select - nall: cryptography support added; will be used to sign future databases (validation will always be optional) - minor shims to fix compilation issues due to nall changes The real magic is that we now have 25-30% of the PAL SNES library in icarus! Signing will be tricky. Obviously if I put the public key inside the higan archive, then all anyone has to do is change that public key for their own releases. And if you download from my site (which is now over HTTPS), then you don't need the signing to verify integrity. I may just put the public key on my site on my site and leave it at that, we'll see.
This commit is contained in:
@@ -67,7 +67,7 @@ template<> struct stringify<signed long long> {
|
||||
char _data[2 + sizeof(signed long long) * 3];
|
||||
};
|
||||
|
||||
#if INTMAX_BITS >= 128
|
||||
#if defined(__SIZEOF_INT128__)
|
||||
template<> struct stringify<int128_t> {
|
||||
stringify(int128_t source) { fromInteger(_data, source); }
|
||||
auto data() const -> const char* { return _data; }
|
||||
@@ -120,7 +120,7 @@ template<> struct stringify<unsigned long long> {
|
||||
char _data[1 + sizeof(unsigned long long) * 3];
|
||||
};
|
||||
|
||||
#if INTMAX_BITS >= 128
|
||||
#if defined(__SIZEOF_INT128__)
|
||||
template<> struct stringify<uint128_t> {
|
||||
stringify(uint128_t source) { fromNatural(_data, source); }
|
||||
auto data() const -> const char* { return _data; }
|
||||
|
@@ -30,6 +30,26 @@ template<typename... P> auto string::assign(P&&... p) -> string& {
|
||||
return append(forward<P>(p)...);
|
||||
}
|
||||
|
||||
template<typename T, typename... P> auto string::prepend(const T& value, P&&... p) -> string& {
|
||||
prepend(forward<P>(p)...);
|
||||
return _prepend(make_string(value));
|
||||
}
|
||||
|
||||
template<typename... P> auto string::prepend(const nall::string_format& value, P&&... p) -> string& {
|
||||
prepend(forward<P>(p)...);
|
||||
return format(value);
|
||||
}
|
||||
|
||||
auto string::prepend() -> string& {
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T> auto string::_prepend(const stringify<T>& source) -> string& {
|
||||
resize(source.size() + size());
|
||||
memory::move(get() + source.size(), get(), size() - source.size());
|
||||
memory::copy(get(), source.data(), source.size());
|
||||
}
|
||||
|
||||
template<typename T, typename... P> auto string::append(const T& value, P&&... p) -> string& {
|
||||
_append(make_string(value));
|
||||
return append(forward<P>(p)...);
|
||||
|
@@ -84,9 +84,9 @@ template<typename T> auto pad(const T& value, long precision, char padchar) -> s
|
||||
return buffer;
|
||||
}
|
||||
|
||||
auto hex(uintmax value, long precision, char padchar) -> string {
|
||||
template<typename T> auto hex(T value, long precision, char padchar) -> string {
|
||||
string buffer;
|
||||
buffer.resize(sizeof(uintmax) * 2);
|
||||
buffer.resize(sizeof(T) * 2);
|
||||
char* p = buffer.get();
|
||||
|
||||
uint size = 0;
|
||||
@@ -101,9 +101,9 @@ auto hex(uintmax value, long precision, char padchar) -> string {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
auto octal(uintmax value, long precision, char padchar) -> string {
|
||||
template<typename T> auto octal(T value, long precision, char padchar) -> string {
|
||||
string buffer;
|
||||
buffer.resize(sizeof(uintmax) * 3);
|
||||
buffer.resize(sizeof(T) * 3);
|
||||
char* p = buffer.get();
|
||||
|
||||
uint size = 0;
|
||||
@@ -117,9 +117,9 @@ auto octal(uintmax value, long precision, char padchar) -> string {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
auto binary(uintmax value, long precision, char padchar) -> string {
|
||||
template<typename T> auto binary(T value, long precision, char padchar) -> string {
|
||||
string buffer;
|
||||
buffer.resize(sizeof(uintmax) * 8);
|
||||
buffer.resize(sizeof(T) * 8);
|
||||
char* p = buffer.get();
|
||||
|
||||
uint size = 0;
|
||||
|
@@ -87,7 +87,7 @@ auto DML::parseBlock(string& block, const string& pathname, uint depth) -> bool
|
||||
if(state.sections++) state.output.append("</section>");
|
||||
state.output.append("<section>");
|
||||
}
|
||||
auto content = lines.takeLeft().trimLeft("# ", 1L).split("::", 1L);
|
||||
auto content = lines.takeLeft().trimLeft("# ", 1L).split("::", 1L).strip();
|
||||
auto data = markup(content[0]);
|
||||
auto name = escape(content(1, data.hash()));
|
||||
state.output.append("<header id=\"", name, "\">", data);
|
||||
@@ -100,7 +100,7 @@ auto DML::parseBlock(string& block, const string& pathname, uint depth) -> bool
|
||||
|
||||
//header
|
||||
else if(auto depth = count(block, '=')) {
|
||||
auto content = slice(lines.takeLeft(), depth + 1).split("::", 1L);
|
||||
auto content = slice(lines.takeLeft(), depth + 1).split("::", 1L).strip();
|
||||
auto data = markup(content[0]);
|
||||
auto name = escape(content(1, data.hash()));
|
||||
if(depth <= 6) {
|
||||
@@ -121,7 +121,7 @@ auto DML::parseBlock(string& block, const string& pathname, uint depth) -> bool
|
||||
if(auto depth = count(line, '-')) {
|
||||
while(level < depth) level++, state.output.append("<ul>\n");
|
||||
while(level > depth) level--, state.output.append("</ul>\n");
|
||||
auto content = slice(line, depth + 1).split("::", 1L);
|
||||
auto content = slice(line, depth + 1).split("::", 1L).strip();
|
||||
auto data = markup(content[0]);
|
||||
auto name = escape(content(1, data.hash()));
|
||||
state.output.append("<li><a href=\"#", name, "\">", data, "</a></li>\n");
|
||||
@@ -204,69 +204,6 @@ auto DML::escape(const string& text) -> string {
|
||||
return output;
|
||||
}
|
||||
|
||||
/* //revision 0.03 parser
|
||||
auto DML::markup(const string& text) -> string {
|
||||
string output;
|
||||
|
||||
char match = 0;
|
||||
uint offset = 0;
|
||||
for(uint n = 0; n < text.size();) {
|
||||
char a = n ? text[n - 1] : 0;
|
||||
char b = text[n];
|
||||
char c = text[n++ + 1];
|
||||
|
||||
bool d = !a || a == ' ' || a == '\t' || a == '\r' || a == '\n'; //is previous character whitespace?
|
||||
bool e = !c || c == ' ' || c == '\t' || c == '\r' || c == '\n'; //is next character whitespace?
|
||||
bool f = (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9'); //is next character alphanumeric?
|
||||
|
||||
if(!match && d && !e) {
|
||||
if(b == '*') { match = '*'; offset = n; continue; }
|
||||
if(b == '/') { match = '/'; offset = n; continue; }
|
||||
if(b == '_') { match = '_'; offset = n; continue; }
|
||||
if(b == '~') { match = '~'; offset = n; continue; }
|
||||
if(b == '|') { match = '|'; offset = n; continue; }
|
||||
if(b == '[') { match = ']'; offset = n; continue; }
|
||||
if(b == '{') { match = '}'; offset = n; continue; }
|
||||
}
|
||||
|
||||
//if we reach the end of the string without a match; force a match so the content is still output
|
||||
if(match && b != match && !c) { b = match; f = 0; n++; }
|
||||
|
||||
if(match && b == match && !f) {
|
||||
match = 0;
|
||||
auto content = slice(text, offset, n - offset - 1);
|
||||
if(b == '*') { output.append("<strong>", escape(content), "</strong>"); continue; }
|
||||
if(b == '/') { output.append("<em>", escape(content), "</em>"); continue; }
|
||||
if(b == '_') { output.append("<ins>", escape(content), "</ins>"); continue; }
|
||||
if(b == '~') { output.append("<del>", escape(content), "</del>"); continue; }
|
||||
if(b == '|') { output.append("<code>", escape(content), "</code>"); continue; }
|
||||
if(b == ']') {
|
||||
auto p = content.split(" => ", 1L);
|
||||
p[0].replace("@/", settings.host);
|
||||
output.append("<a href=\"", escape(p[0]), "\">", escape(p(1, p[0])), "</a>");
|
||||
continue;
|
||||
}
|
||||
if(b == '}') {
|
||||
auto p = content.split(" => ", 1L);
|
||||
p[0].replace("@/", settings.host);
|
||||
output.append("<img src=\"", escape(p[0]), "\" alt=\"", escape(p(1, "")), "\">");
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if(match) continue;
|
||||
if(b == '\\' && c) { output.append(c); n++; continue; } //character escaping
|
||||
if(b == '&') { output.append("&"); continue; } //entity escaping
|
||||
if(b == '<') { output.append("<"); continue; } //...
|
||||
if(b == '>') { output.append(">"); continue; } //...
|
||||
if(b == '"') { output.append("""); continue; } //...
|
||||
output.append(b);
|
||||
}
|
||||
|
||||
return output;
|
||||
} */
|
||||
|
||||
auto DML::markup(const string& s) -> string {
|
||||
string t;
|
||||
|
||||
|
@@ -92,11 +92,11 @@ auto slice(string_view self, int offset, int length) -> string {
|
||||
return result;
|
||||
}
|
||||
|
||||
auto fromInteger(char* result, intmax value) -> char* {
|
||||
template<typename T> auto fromInteger(char* result, T value) -> char* {
|
||||
bool negative = value < 0;
|
||||
if(negative) value = -value;
|
||||
|
||||
char buffer[64];
|
||||
char buffer[1 + sizeof(T) * 3];
|
||||
uint size = 0;
|
||||
|
||||
do {
|
||||
@@ -111,8 +111,8 @@ auto fromInteger(char* result, intmax value) -> char* {
|
||||
return result;
|
||||
}
|
||||
|
||||
auto fromNatural(char* result, uintmax value) -> char* {
|
||||
char buffer[64];
|
||||
template<typename T> auto fromNatural(char* result, T value) -> char* {
|
||||
char buffer[1 + sizeof(T) * 3];
|
||||
uint size = 0;
|
||||
|
||||
do {
|
||||
@@ -129,13 +129,13 @@ auto fromNatural(char* result, uintmax value) -> char* {
|
||||
//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.
|
||||
auto fromReal(char* result, long double value) -> uint {
|
||||
template<typename T> auto fromReal(char* result, T value) -> uint {
|
||||
char buffer[256];
|
||||
#ifdef _WIN32
|
||||
//Windows C-runtime does not support long double via sprintf()
|
||||
sprintf(buffer, "%f", (double)value);
|
||||
#else
|
||||
sprintf(buffer, "%Lf", value);
|
||||
sprintf(buffer, "%Lf", (long double)value);
|
||||
#endif
|
||||
|
||||
//remove excess 0's in fraction (2.500000 -> 2.5)
|
||||
|
Reference in New Issue
Block a user