mirror of
https://github.com/libretro/bsnes-libretro.git
synced 2024-11-23 08:59:40 +00:00
3a9c7c6843
byuu says: Changelog: - Emulator::Interface::Medium::bootable removed - Emulator::Interface::load(bool required) argument removed [File::Required makes no sense on a folder] - Super Famicom.sys now has user-configurable properties (CPU,PPU1,PPU2 version; PPU1 VRAM size, Region override) - old nall/property removed completely - volatile flags supported on coprocessor RAM files now (still not in icarus, though) - (hopefully) fixed SNES Multitap support (needs testing) - fixed an OAM tiledata range clipping limit in 128KiB VRAM mode (doesn't fix Yoshi's Island, sadly) - (hopefully, again) fixed the input polling bug hex_usr reported - re-added dialog box for when File::Required files are missing - really cool: if you're missing a boot ROM, BIOS ROM, or IPL ROM, it warns you immediately - you don't have to select a game before seeing the error message anymore - fixed cheats.bml load/save location
68 lines
2.0 KiB
C++
68 lines
2.0 KiB
C++
#pragma once
|
|
|
|
namespace nall {
|
|
|
|
template<typename T> struct property {
|
|
property() = default;
|
|
property(const T& value) : value(value) {}
|
|
|
|
operator T&() { return value; } //direct assignment
|
|
auto operator->() -> T* { return &value; } //class-member access
|
|
|
|
operator const T&() const { return value; }
|
|
auto operator()() const -> const T& { return value; }
|
|
auto get() const -> const T& { return value; }
|
|
|
|
auto operator=(const T& value) -> T& { return this->value = value; }
|
|
auto set(const T& value) -> T& { return this->value = value; }
|
|
|
|
T value;
|
|
};
|
|
|
|
template<typename T, typename R = T> struct functional_property {
|
|
functional_property(
|
|
const function<R (const T&)>& getter = {},
|
|
const function<R (T&, const T&)>& setter = {},
|
|
const T& value = {}
|
|
) {
|
|
getter ? this->getter = getter : this->getter = [](const T& self) -> R { return self; };
|
|
setter ? this->setter = setter : this->setter = [](T& self, const T& value) -> R { return self = value; };
|
|
this->setter(this->value, value);
|
|
}
|
|
|
|
operator R() const { return getter(value); }
|
|
auto operator()() const -> R { return getter(value); }
|
|
auto get() const -> R { return getter(value); }
|
|
|
|
auto operator=(const T& value) -> R { return setter(this->value, value); }
|
|
auto set(const T& value) -> R { return setter(this->value, value); }
|
|
|
|
T value;
|
|
function<R (const T&)> getter;
|
|
function<R (T&, const T&)> setter;
|
|
};
|
|
|
|
template<typename T, typename R = T> struct virtual_property {
|
|
virtual_property(
|
|
const function<R ()>& getter = {},
|
|
const function<R (const T&)>& setter = {},
|
|
const T& value = {}
|
|
) {
|
|
this->getter = getter;
|
|
this->setter = setter;
|
|
if(this->setter) this->setter(value);
|
|
}
|
|
|
|
operator R() const { return getter(); }
|
|
auto operator()() const -> R { return getter(); }
|
|
auto get() const -> R { return getter(); }
|
|
|
|
auto operator=(const T& value) -> R { return setter(value); }
|
|
auto set(const T& value) -> R { return setter(value); }
|
|
|
|
function<R ()> getter;
|
|
function<R (const T&)> setter;
|
|
};
|
|
|
|
}
|