Update to v094r09 release.
byuu says:
This will easily be the biggest diff in the history of higan. And not in
a good way.
* target-higan and target-loki have been blown away completely
* nall and ruby massively updated
* phoenix replaced with hiro (pretty near a total rewrite)
* target-higan restarted using hiro (just a window for now)
* all emulation cores updated to compile again
* installation changed to not require root privileges (installs locally)
For the foreseeable future (maybe even permanently?), the new higan UI
will only build under Linux/BSD with GTK+ 2.20+. Probably the most
likely route for Windows/OS X will be to try and figure out how to build
hiro/GTK on those platforms, as awful as that would be. The other
alternative would be to produce new UIs for those platforms ... which
would actually be a good opportunity to make something much more user
friendly.
Being that I just started on this a few hours ago, that means that for
at least a few weeks, don't expect to be able to actually play any
games. Right now, you can pretty much just compile the binary and that's
it. It's quite possible that some nall changes didn't produce
compilation errors, but will produce runtime errors. So until the UI can
actually load games, we won't know if anything is broken. But we should
mostly be okay. It was mostly just trim<1> -> trim changes, moving to
Hash::SHA256 (much cleaner), and patching some reckless memory copy
functions enough to compile.
Progress isn't going to be like it was before: I'm now dividing my time
much thinner between studying and other hobbies.
My aim this time is not to produce a binary for everyone to play games
on. Rather, it's to keep the emulator alive. I want to be able to apply
critical patches again. And I would also like the base of the emulator
to live on, for use in other emulator frontends that utilize higan.
2015-02-26 10:10:46 +00:00
|
|
|
#ifndef NALL_HTTP_REQUEST_HPP
|
|
|
|
#define NALL_HTTP_REQUEST_HPP
|
|
|
|
|
|
|
|
#include <nall/http/message.hpp>
|
|
|
|
|
|
|
|
namespace nall {
|
|
|
|
|
|
|
|
struct httpRequest : httpMessage {
|
|
|
|
using type = httpRequest;
|
|
|
|
|
|
|
|
enum class RequestType : unsigned { None, Head, Get, Post };
|
|
|
|
|
|
|
|
explicit operator bool() const { return requestType() != RequestType::None; }
|
|
|
|
|
|
|
|
inline auto head(const function<bool (const uint8_t* data, unsigned size)>& callback) const -> bool;
|
|
|
|
inline auto setHead() -> bool;
|
|
|
|
|
|
|
|
inline auto body(const function<bool (const uint8_t* data, unsigned size)>& callback) const -> bool;
|
|
|
|
inline auto setBody() -> bool;
|
|
|
|
|
|
|
|
auto ip() const -> string {
|
|
|
|
return {(uint8_t)(_ip >> 24), ".", (uint8_t)(_ip >> 16), ".", (uint8_t)(_ip >> 8), ".", (uint8_t)(_ip >> 0)};
|
|
|
|
}
|
|
|
|
|
|
|
|
auto requestType() const -> RequestType { return _requestType; }
|
|
|
|
auto setRequestType(RequestType value) -> void { _requestType = value; }
|
|
|
|
|
|
|
|
auto path() const -> string { return _path; }
|
|
|
|
auto setPath(const string& value) -> void { _path = value; }
|
|
|
|
|
|
|
|
auto appendHeader(const string& name, const string& value = "") -> type& { return httpMessage::appendHeader(name, value), *this; }
|
|
|
|
auto removeHeader(const string& name) -> type& { return httpMessage::removeHeader(name), *this; }
|
|
|
|
auto setHeader(const string& name, const string& value = "") -> type& { return httpMessage::setHeader(name, value), *this; }
|
|
|
|
|
Update to v094r17 release.
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.
2015-05-02 13:05:46 +00:00
|
|
|
auto cookie(const string& name) const -> string { return _cookie.get(name); }
|
|
|
|
auto setCookie(const string& name, const string& value = "") -> void { _cookie.set(name, value); }
|
Update to v094r09 release.
byuu says:
This will easily be the biggest diff in the history of higan. And not in
a good way.
* target-higan and target-loki have been blown away completely
* nall and ruby massively updated
* phoenix replaced with hiro (pretty near a total rewrite)
* target-higan restarted using hiro (just a window for now)
* all emulation cores updated to compile again
* installation changed to not require root privileges (installs locally)
For the foreseeable future (maybe even permanently?), the new higan UI
will only build under Linux/BSD with GTK+ 2.20+. Probably the most
likely route for Windows/OS X will be to try and figure out how to build
hiro/GTK on those platforms, as awful as that would be. The other
alternative would be to produce new UIs for those platforms ... which
would actually be a good opportunity to make something much more user
friendly.
Being that I just started on this a few hours ago, that means that for
at least a few weeks, don't expect to be able to actually play any
games. Right now, you can pretty much just compile the binary and that's
it. It's quite possible that some nall changes didn't produce
compilation errors, but will produce runtime errors. So until the UI can
actually load games, we won't know if anything is broken. But we should
mostly be okay. It was mostly just trim<1> -> trim changes, moving to
Hash::SHA256 (much cleaner), and patching some reckless memory copy
functions enough to compile.
Progress isn't going to be like it was before: I'm now dividing my time
much thinner between studying and other hobbies.
My aim this time is not to produce a binary for everyone to play games
on. Rather, it's to keep the emulator alive. I want to be able to apply
critical patches again. And I would also like the base of the emulator
to live on, for use in other emulator frontends that utilize higan.
2015-02-26 10:10:46 +00:00
|
|
|
|
Update to v094r17 release.
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.
2015-05-02 13:05:46 +00:00
|
|
|
auto get(const string& name) const -> string { return _get.get(name); }
|
|
|
|
auto setGet(const string& name, const string& value = "") -> void { _get.set(name, value); }
|
|
|
|
|
|
|
|
auto post(const string& name) const -> string { return _post.get(name); }
|
|
|
|
auto setPost(const string& name, const string& value = "") -> void { _post.set(name, value); }
|
Update to v094r09 release.
byuu says:
This will easily be the biggest diff in the history of higan. And not in
a good way.
* target-higan and target-loki have been blown away completely
* nall and ruby massively updated
* phoenix replaced with hiro (pretty near a total rewrite)
* target-higan restarted using hiro (just a window for now)
* all emulation cores updated to compile again
* installation changed to not require root privileges (installs locally)
For the foreseeable future (maybe even permanently?), the new higan UI
will only build under Linux/BSD with GTK+ 2.20+. Probably the most
likely route for Windows/OS X will be to try and figure out how to build
hiro/GTK on those platforms, as awful as that would be. The other
alternative would be to produce new UIs for those platforms ... which
would actually be a good opportunity to make something much more user
friendly.
Being that I just started on this a few hours ago, that means that for
at least a few weeks, don't expect to be able to actually play any
games. Right now, you can pretty much just compile the binary and that's
it. It's quite possible that some nall changes didn't produce
compilation errors, but will produce runtime errors. So until the UI can
actually load games, we won't know if anything is broken. But we should
mostly be okay. It was mostly just trim<1> -> trim changes, moving to
Hash::SHA256 (much cleaner), and patching some reckless memory copy
functions enough to compile.
Progress isn't going to be like it was before: I'm now dividing my time
much thinner between studying and other hobbies.
My aim this time is not to produce a binary for everyone to play games
on. Rather, it's to keep the emulator alive. I want to be able to apply
critical patches again. And I would also like the base of the emulator
to live on, for use in other emulator frontends that utilize higan.
2015-02-26 10:10:46 +00:00
|
|
|
|
|
|
|
//private:
|
|
|
|
uint32_t _ip = 0;
|
|
|
|
RequestType _requestType = RequestType::None;
|
|
|
|
string _path;
|
|
|
|
httpVariables _cookie;
|
|
|
|
httpVariables _get;
|
|
|
|
httpVariables _post;
|
|
|
|
};
|
|
|
|
|
|
|
|
auto httpRequest::head(const function<bool (const uint8_t*, unsigned)>& callback) const -> bool {
|
|
|
|
if(!callback) return false;
|
|
|
|
string output;
|
|
|
|
|
|
|
|
string request = path();
|
|
|
|
if(_get.size()) {
|
|
|
|
request.append("?");
|
|
|
|
for(auto& get : _get) {
|
|
|
|
request.append(get.name, "=", get.value, "&");
|
|
|
|
}
|
|
|
|
request.rtrim("&");
|
|
|
|
}
|
|
|
|
|
|
|
|
switch(requestType()) {
|
|
|
|
case RequestType::Head: output.append("HEAD ", request, " HTTP/1.1\r\n"); break;
|
|
|
|
case RequestType::Get : output.append("GET ", request, " HTTP/1.1\r\n"); break;
|
|
|
|
case RequestType::Post: output.append("POST ", request, " HTTP/1.1\r\n"); break;
|
|
|
|
default: return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
for(auto& header : _header) {
|
|
|
|
output.append(header.name, ": ", header.value, "\r\n");
|
|
|
|
}
|
|
|
|
output.append("\r\n");
|
|
|
|
|
|
|
|
return callback(output.binary(), output.size());
|
|
|
|
}
|
|
|
|
|
|
|
|
auto httpRequest::setHead() -> bool {
|
|
|
|
lstring headers = _head.split("\n");
|
|
|
|
string request = headers.takeFirst().rtrim("\r");
|
|
|
|
string requestHost;
|
|
|
|
|
|
|
|
if(irtrim(request, " HTTP/1.0"));
|
|
|
|
else if(irtrim(request, " HTTP/1.1"));
|
|
|
|
else return false;
|
|
|
|
|
|
|
|
if(iltrim(request, "HEAD ")) setRequestType(RequestType::Head);
|
|
|
|
else if(iltrim(request, "GET " )) setRequestType(RequestType::Get );
|
|
|
|
else if(iltrim(request, "POST ")) setRequestType(RequestType::Post);
|
|
|
|
else return false;
|
|
|
|
|
|
|
|
//decode absolute URIs
|
|
|
|
request.strip().iltrim("http://");
|
|
|
|
if(!request.beginsWith("/")) {
|
|
|
|
lstring components = request.split<1>("/");
|
|
|
|
requestHost = components(0);
|
|
|
|
request = {"/", components(1)};
|
|
|
|
}
|
|
|
|
|
|
|
|
lstring components = request.split<1>("?");
|
|
|
|
setPath(components(0));
|
|
|
|
|
|
|
|
if(auto queryString = components(1)) {
|
|
|
|
for(auto& block : queryString.split("&")) {
|
|
|
|
lstring variable = block.split<1>("=");
|
|
|
|
if(variable(0)) setGet(variable(0), variable(1));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for(auto& header : headers) {
|
|
|
|
if(header.beginsWith(" ") || header.beginsWith("\t")) continue;
|
|
|
|
auto part = header.split<1>(":").strip();
|
|
|
|
if(!part[0] || part.size() != 2) continue;
|
|
|
|
appendHeader(part[0], part[1]);
|
Update to v094r17 release.
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.
2015-05-02 13:05:46 +00:00
|
|
|
|
|
|
|
if(part[0].iequals("Cookie")) {
|
|
|
|
for(auto& block : part[1].split(";")) {
|
|
|
|
lstring variable = block.split<1>("=").strip();
|
|
|
|
variable(1).ltrim("\"").rtrim("\"");
|
|
|
|
if(variable(0)) setCookie(variable(0), variable(1));
|
|
|
|
}
|
|
|
|
}
|
Update to v094r09 release.
byuu says:
This will easily be the biggest diff in the history of higan. And not in
a good way.
* target-higan and target-loki have been blown away completely
* nall and ruby massively updated
* phoenix replaced with hiro (pretty near a total rewrite)
* target-higan restarted using hiro (just a window for now)
* all emulation cores updated to compile again
* installation changed to not require root privileges (installs locally)
For the foreseeable future (maybe even permanently?), the new higan UI
will only build under Linux/BSD with GTK+ 2.20+. Probably the most
likely route for Windows/OS X will be to try and figure out how to build
hiro/GTK on those platforms, as awful as that would be. The other
alternative would be to produce new UIs for those platforms ... which
would actually be a good opportunity to make something much more user
friendly.
Being that I just started on this a few hours ago, that means that for
at least a few weeks, don't expect to be able to actually play any
games. Right now, you can pretty much just compile the binary and that's
it. It's quite possible that some nall changes didn't produce
compilation errors, but will produce runtime errors. So until the UI can
actually load games, we won't know if anything is broken. But we should
mostly be okay. It was mostly just trim<1> -> trim changes, moving to
Hash::SHA256 (much cleaner), and patching some reckless memory copy
functions enough to compile.
Progress isn't going to be like it was before: I'm now dividing my time
much thinner between studying and other hobbies.
My aim this time is not to produce a binary for everyone to play games
on. Rather, it's to keep the emulator alive. I want to be able to apply
critical patches again. And I would also like the base of the emulator
to live on, for use in other emulator frontends that utilize higan.
2015-02-26 10:10:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(requestHost) setHeader("Host", requestHost); //request URI overrides host header
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto httpRequest::body(const function<bool (const uint8_t*, unsigned)>& callback) const -> bool {
|
|
|
|
if(!callback) return false;
|
|
|
|
|
|
|
|
if(_body) {
|
|
|
|
return callback(_body.binary(), _body.size());
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto httpRequest::setBody() -> bool {
|
|
|
|
if(requestType() == RequestType::Post) {
|
|
|
|
if(header("Content-Type").iequals("application/x-www-form-urlencoded")) {
|
Update to v094r17 release.
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.
2015-05-02 13:05:46 +00:00
|
|
|
for(auto& block : _body.split("&")) {
|
Update to v094r09 release.
byuu says:
This will easily be the biggest diff in the history of higan. And not in
a good way.
* target-higan and target-loki have been blown away completely
* nall and ruby massively updated
* phoenix replaced with hiro (pretty near a total rewrite)
* target-higan restarted using hiro (just a window for now)
* all emulation cores updated to compile again
* installation changed to not require root privileges (installs locally)
For the foreseeable future (maybe even permanently?), the new higan UI
will only build under Linux/BSD with GTK+ 2.20+. Probably the most
likely route for Windows/OS X will be to try and figure out how to build
hiro/GTK on those platforms, as awful as that would be. The other
alternative would be to produce new UIs for those platforms ... which
would actually be a good opportunity to make something much more user
friendly.
Being that I just started on this a few hours ago, that means that for
at least a few weeks, don't expect to be able to actually play any
games. Right now, you can pretty much just compile the binary and that's
it. It's quite possible that some nall changes didn't produce
compilation errors, but will produce runtime errors. So until the UI can
actually load games, we won't know if anything is broken. But we should
mostly be okay. It was mostly just trim<1> -> trim changes, moving to
Hash::SHA256 (much cleaner), and patching some reckless memory copy
functions enough to compile.
Progress isn't going to be like it was before: I'm now dividing my time
much thinner between studying and other hobbies.
My aim this time is not to produce a binary for everyone to play games
on. Rather, it's to keep the emulator alive. I want to be able to apply
critical patches again. And I would also like the base of the emulator
to live on, for use in other emulator frontends that utilize higan.
2015-02-26 10:10:46 +00:00
|
|
|
lstring variable = block.rtrim("\r").split<1>("=");
|
|
|
|
if(variable(0)) setPost(variable(0), variable(1));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|