2016-10-27 21:16:58 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <nall/arithmetic.hpp>
|
|
|
|
#include <nall/range.hpp>
|
|
|
|
#include <nall/string.hpp>
|
|
|
|
|
|
|
|
//cannot use constructor inheritance due to needing to call virtual reset();
|
|
|
|
//instead, define a macro to reduce boilerplate code in every Hash subclass
|
|
|
|
#define nallHash(Name) \
|
|
|
|
Name() { reset(); } \
|
|
|
|
Name(const void* data, uint64_t size) : Name() { input(data, size); } \
|
|
|
|
Name(const vector<uint8_t>& data) : Name() { input(data); } \
|
|
|
|
Name(const string& data) : Name() { input(data); } \
|
|
|
|
using Hash::input; \
|
|
|
|
|
2019-01-16 00:46:42 +00:00
|
|
|
namespace nall::Hash {
|
2016-10-27 21:16:58 +00:00
|
|
|
|
|
|
|
struct Hash {
|
|
|
|
virtual auto reset() -> void = 0;
|
|
|
|
virtual auto input(uint8_t data) -> void = 0;
|
|
|
|
virtual auto output() const -> vector<uint8_t> = 0;
|
|
|
|
|
Update to v106r59 release.
byuu says:
Changelog:
- fixed bug in Emulator::Game::Memory::operator bool()
- nall: renamed view<string> back to `string_view`
- nall:: implemented `array_view`
- Game Boy: split cartridge-specific input mappings (rumble,
accelerometer) to their own separate ports
- Game Boy: fixed MBC7 accelerometer x-axis
- icarus: Game Boy, Super Famicom, Mega Drive cores output internal
header game titles to heuristics manifests
- higan, icarus, hiro/gtk: improve viewport geometry configuration;
fixed higan crashing bug with XShm driver
- higan: connect Video::poll(),update() functionality
- hiro, ruby: several compilation / bugfixes, should get the macOS
port compiling again, hopefully [Sintendo]
- ruby/video/xshm: fix crashing bug on window resize
- a bit hacky; it's throwing BadAccess Xlib warnings, but they're
not fatal, so I am catching and ignoring them
- bsnes: removed Application::Windows::onModalChange hook that's no
longer needed [Screwtape]
2018-08-26 06:49:54 +00:00
|
|
|
auto input(array_view<uint8_t> data) -> void {
|
|
|
|
for(auto byte : data) input(byte);
|
|
|
|
}
|
|
|
|
|
2016-10-27 21:16:58 +00:00
|
|
|
auto input(const void* data, uint64_t size) -> void {
|
|
|
|
auto p = (const uint8_t*)data;
|
|
|
|
while(size--) input(*p++);
|
|
|
|
}
|
|
|
|
|
|
|
|
auto input(const vector<uint8_t>& data) -> void {
|
|
|
|
for(auto byte : data) input(byte);
|
|
|
|
}
|
|
|
|
|
|
|
|
auto input(const string& data) -> void {
|
|
|
|
for(auto byte : data) input(byte);
|
|
|
|
}
|
|
|
|
|
|
|
|
auto digest() const -> string {
|
|
|
|
string result;
|
|
|
|
for(auto n : output()) result.append(hex(n, 2L));
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-01-16 00:46:42 +00:00
|
|
|
}
|