mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-02-24 15:12:23 +01:00
byuu says: Changelog: - entire GBA core ported to auto function() -> return; syntax - fixed GBA BLDY bug that was causing flickering in a few games - replaced nall/config usage with nall/string/markup/node - this merges all configuration files to a unified settings.bml file - added "Ignore Manifests" option to the advanced setting tab - this lets you keep a manifest.bml for an older version of higan; if you want to do regression testing Be sure to remap your controller/hotkey inputs, and for SNES, choose "Gamepad" from "Controller Port 1" in the system menu. Otherwise you won't get any input. No need to blow away your old config files, unless you want to.
54 lines
1.2 KiB
C++
54 lines
1.2 KiB
C++
#ifndef NALL_RANGE_HPP
|
|
#define NALL_RANGE_HPP
|
|
|
|
namespace nall {
|
|
|
|
struct range_t {
|
|
struct iterator {
|
|
iterator(int position, int step = 0) : position(position), step(step) {}
|
|
auto operator*() const -> int { return position; }
|
|
auto operator!=(const iterator& source) const -> bool { return step > 0 ? position < source.position : position > source.position; }
|
|
auto operator++() -> iterator& { position += step; return *this; }
|
|
|
|
private:
|
|
int position;
|
|
const int step;
|
|
};
|
|
|
|
auto begin() const -> const iterator { return iterator(origin, stride); }
|
|
auto end() const -> const iterator { return iterator(target); }
|
|
|
|
int origin;
|
|
int target;
|
|
int stride;
|
|
};
|
|
|
|
inline auto range(int size) {
|
|
return range_t{0, size, 1};
|
|
}
|
|
|
|
inline auto range(int offset, int size) {
|
|
return range_t{offset, size, 1};
|
|
}
|
|
|
|
inline auto range(int offset, int size, int step) {
|
|
return range_t{offset, size, step};
|
|
}
|
|
|
|
//reverse-range
|
|
inline auto rrange(int size) {
|
|
return range_t{size - 1, -1, -1};
|
|
}
|
|
|
|
template<typename T> inline auto range(const vector<T>& container) {
|
|
return range_t{0, (int)container.size(), 1};
|
|
}
|
|
|
|
template<typename T> inline auto rrange(const vector<T>& container) {
|
|
return range_t{(int)container.size() - 1, -1, -1};
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|