mirror of
https://github.com/Rakashazi/emu-ex-plus-alpha.git
synced 2024-11-27 07:30:22 +00:00
1.5.82 release
* Imagine: Update C++ standard to C++26 and fix build issues * Imagine: Add visit() member function for variant types using AddVisit CRTP class * Imagine: Clean up decltype usage in various headers * Imagine: Remove unused bundled FreeType library * Imagine: Fix evaluating LD variable in makefiles too early * NES.emu: Add/Update Lightful and Palightful palettes * C64.emu, GBA.emu, GBC.emu, MD.emu, PCE.emu, Saturn.emu: Fix C++26 build errors due to deprecated arithmetic conversions on enums
This commit is contained in:
parent
ff8573d155
commit
540c1e6e74
@ -579,7 +579,7 @@ bool SID::set_sampling_parameters(double clock_freq, sampling_method method,
|
||||
if (method == SAMPLE_RESAMPLE || method == SAMPLE_RESAMPLE_FASTMEM)
|
||||
{
|
||||
// Check whether the sample ring buffer would overfill.
|
||||
if (FIR_N*clock_freq/sample_freq >= RINGSIZE) {
|
||||
if (double(FIR_N)*clock_freq/sample_freq >= double(RINGSIZE)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -44,8 +44,6 @@ template<DataPathSelectMode mode, ArchivePathSelectMode archiveMode = ArchivePat
|
||||
class DataPathSelectView : public TableView, public EmuAppHelper
|
||||
{
|
||||
public:
|
||||
using EmuAppHelper::app;
|
||||
|
||||
enum class Mode: uint8_t
|
||||
{
|
||||
File, Folder
|
||||
|
@ -378,10 +378,11 @@ public:
|
||||
|
||||
using VControllerElementVariant = std::variant<VControllerButtonGroup, VControllerUIButtonGroup, VControllerDPad>;
|
||||
|
||||
class VControllerElement : public VControllerElementVariant
|
||||
class VControllerElement : public VControllerElementVariant, public AddVisit
|
||||
{
|
||||
public:
|
||||
using VControllerElementVariant::VControllerElementVariant;
|
||||
using AddVisit::visit;
|
||||
|
||||
std::array<VControllerLayoutPosition, 2> layoutPos;
|
||||
VControllerState state{VControllerState::SHOWN};
|
||||
@ -394,13 +395,13 @@ public:
|
||||
{
|
||||
return (sizeof(VControllerLayoutPosition::pos) + sizeof(_2DOrigin::PackedType)) * 2
|
||||
+ sizeof(state)
|
||||
+ visit([](auto &e){ return e.configSize(); }, *this);
|
||||
+ visit([](auto &e){ return e.configSize(); });
|
||||
}
|
||||
|
||||
WRect bounds() const { return visit([](auto &e){ return e.bounds(); }, *this); }
|
||||
WRect realBounds() const { return visit([](auto &e){ return e.realBounds(); }, *this); }
|
||||
void setPos(WPt pos, WRect viewBounds) { visit([&](auto &e){ e.setPos(pos, viewBounds); }, *this); }
|
||||
void setAlpha(float alpha) { visit([&](auto &e){ e.setAlpha(alpha); }, *this); }
|
||||
WRect bounds() const { return visit([](auto &e){ return e.bounds(); }); }
|
||||
WRect realBounds() const { return visit([](auto &e){ return e.realBounds(); }); }
|
||||
void setPos(WPt pos, WRect viewBounds) { visit([&](auto &e){ e.setPos(pos, viewBounds); }); }
|
||||
void setAlpha(float alpha) { visit([&](auto &e){ e.setAlpha(alpha); }); }
|
||||
|
||||
static bool shouldDraw(VControllerState state, bool showHidden)
|
||||
{
|
||||
@ -411,7 +412,7 @@ public:
|
||||
{
|
||||
if(!shouldDraw(state, showHidden))
|
||||
return;
|
||||
visit([&](auto &e){ e.drawButtons(cmds); }, *this);
|
||||
visit([&](auto &e){ e.drawButtons(cmds); });
|
||||
}
|
||||
|
||||
void drawBounds(Gfx::RendererCommands &__restrict__ cmds, bool showHidden) const
|
||||
@ -424,7 +425,7 @@ public:
|
||||
{
|
||||
e.drawBounds(cmds);
|
||||
}
|
||||
}, *this);
|
||||
});
|
||||
}
|
||||
|
||||
void place(WRect viewBounds, WRect windowBounds, int layoutIdx)
|
||||
@ -440,7 +441,7 @@ public:
|
||||
[&](VControllerDPad &e){ e.setShowBounds(r, on); },
|
||||
[&](VControllerButtonGroup &e){ e.setShowBounds(on); },
|
||||
[](auto &e){}
|
||||
}, *this);
|
||||
});
|
||||
}
|
||||
|
||||
_2DOrigin layoutOrigin() const
|
||||
@ -449,12 +450,12 @@ public:
|
||||
{
|
||||
[&](const VControllerDPad &e){ return LB2DO; },
|
||||
[](auto &e){ return e.layout.origin; }
|
||||
}, *this);
|
||||
});
|
||||
}
|
||||
|
||||
std::string name(const InputManager &mgr) const
|
||||
{
|
||||
return visit([&](auto &e){ return e.name(mgr); }, *this);
|
||||
return visit([&](auto &e){ return e.name(mgr); });
|
||||
}
|
||||
|
||||
void updateMeasurements(const Window &win)
|
||||
@ -465,7 +466,7 @@ public:
|
||||
{
|
||||
e.updateMeasurements(win);
|
||||
}
|
||||
}, *this);
|
||||
});
|
||||
}
|
||||
|
||||
void transposeKeysForPlayer(const InputManager &mgr, int player)
|
||||
@ -476,7 +477,7 @@ public:
|
||||
{
|
||||
e.transposeKeysForPlayer(mgr, player);
|
||||
}
|
||||
}, *this);
|
||||
});
|
||||
}
|
||||
|
||||
std::span<VControllerButton> buttons()
|
||||
@ -487,7 +488,7 @@ public:
|
||||
return e.buttons;
|
||||
else
|
||||
return {};
|
||||
}, *this);
|
||||
});
|
||||
}
|
||||
|
||||
void add(KeyInfo keyCode)
|
||||
@ -498,7 +499,7 @@ public:
|
||||
{
|
||||
e.buttons.emplace_back(keyCode);
|
||||
}
|
||||
}, *this);
|
||||
});
|
||||
}
|
||||
|
||||
void remove(VControllerButton &btnToErase)
|
||||
@ -509,7 +510,7 @@ public:
|
||||
{
|
||||
std::erase_if(e.buttons, [&](auto &b) { return &b == &btnToErase; });
|
||||
}
|
||||
}, *this);
|
||||
});
|
||||
}
|
||||
|
||||
void setRowSize(int8_t size)
|
||||
@ -518,7 +519,7 @@ public:
|
||||
{
|
||||
if constexpr(requires {e.layout.rowItems;})
|
||||
e.layout.rowItems = size;
|
||||
}, *this);
|
||||
});
|
||||
}
|
||||
|
||||
auto rowSize() const
|
||||
@ -529,7 +530,7 @@ public:
|
||||
return e.layout.rowItems;
|
||||
else
|
||||
return 1;
|
||||
}, *this);
|
||||
});
|
||||
}
|
||||
|
||||
void updateSprite(VControllerButton &b)
|
||||
@ -538,7 +539,7 @@ public:
|
||||
{
|
||||
if constexpr(requires {e.updateSprite(b);})
|
||||
e.updateSprite(b);
|
||||
}, *this);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include <imagine/input/inputDefs.hh>
|
||||
#include <imagine/util/container/array.hh>
|
||||
#include <imagine/util/concepts.hh>
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
|
||||
@ -49,7 +50,7 @@ struct KeyInfo
|
||||
|
||||
constexpr KeyInfo() = default;
|
||||
|
||||
constexpr KeyInfo(auto code, KeyFlags flags = {}):
|
||||
constexpr KeyInfo(NotPointer auto code, KeyFlags flags = {}):
|
||||
codes{KeyCode(code)}, flags{flags} {}
|
||||
|
||||
template <class T>
|
||||
|
@ -1,4 +1,4 @@
|
||||
metadata_version = 1.5.81
|
||||
metadata_version = 1.5.82
|
||||
metadata_supportedMIMETypes = application/zip
|
||||
metadata_supportedFileExtensions = rar 7z
|
||||
android_metadata_versionCodeExtra = 16
|
||||
|
@ -226,7 +226,7 @@ void ButtonConfigSetView::place()
|
||||
|
||||
bool ButtonConfigSetView::inputEvent(const Input::Event &e)
|
||||
{
|
||||
return visit(overloaded
|
||||
return e.visit(overloaded
|
||||
{
|
||||
[&](const Input::MotionEvent &motionEv)
|
||||
{
|
||||
@ -300,7 +300,7 @@ bool ButtonConfigSetView::inputEvent(const Input::Event &e)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}, e);
|
||||
});
|
||||
}
|
||||
|
||||
void ButtonConfigSetView::finalize()
|
||||
|
@ -59,11 +59,11 @@ void CreditsView::place()
|
||||
|
||||
bool CreditsView::inputEvent(const Input::Event &e)
|
||||
{
|
||||
if(visit(overloaded
|
||||
if(e.visit(overloaded
|
||||
{
|
||||
[&](const Input::MotionEvent &e) { return viewRect().overlaps(e.pos()) && e.released(); },
|
||||
[&](const Input::KeyEvent &e) { return e.pushed(Input::DefaultKey::CANCEL); }
|
||||
}, e))
|
||||
}))
|
||||
{
|
||||
dismiss();
|
||||
return true;
|
||||
|
@ -75,7 +75,7 @@ void EmuInputView::updateRunSpeed(AltSpeedMode mode)
|
||||
|
||||
bool EmuInputView::inputEvent(const Input::Event &e)
|
||||
{
|
||||
return visit(overloaded
|
||||
return e.visit(overloaded
|
||||
{
|
||||
[&](const Input::MotionEvent &motionEv)
|
||||
{
|
||||
@ -139,7 +139,7 @@ bool EmuInputView::inputEvent(const Input::Event &e)
|
||||
|| keyEv.isGamepad() // consume all gamepad events
|
||||
|| devData.devConf.shouldHandleUnboundKeys;
|
||||
}
|
||||
}, e);
|
||||
});
|
||||
}
|
||||
|
||||
void EmuInputView::setSystemGestureExclusion(bool on)
|
||||
|
@ -53,7 +53,7 @@ void IdentInputDeviceView::place()
|
||||
|
||||
bool IdentInputDeviceView::inputEvent(const Input::Event &e)
|
||||
{
|
||||
return visit(overloaded
|
||||
return e.visit(overloaded
|
||||
{
|
||||
[&](const Input::MotionEvent &e)
|
||||
{
|
||||
@ -75,7 +75,7 @@ bool IdentInputDeviceView::inputEvent(const Input::Event &e)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}, e);
|
||||
});
|
||||
}
|
||||
|
||||
void IdentInputDeviceView::draw(Gfx::RendererCommands &__restrict__ cmds)
|
||||
|
@ -84,7 +84,7 @@ void PlaceVControlsView::place()
|
||||
|
||||
bool PlaceVControlsView::inputEvent(const Input::Event &e)
|
||||
{
|
||||
return visit(overloaded
|
||||
return e.visit(overloaded
|
||||
{
|
||||
[&](const Input::KeyEvent &e)
|
||||
{
|
||||
@ -170,7 +170,7 @@ bool PlaceVControlsView::inputEvent(const Input::Event &e)
|
||||
});
|
||||
return true;
|
||||
}
|
||||
}, e);
|
||||
});
|
||||
}
|
||||
|
||||
void PlaceVControlsView::draw(Gfx::RendererCommands &__restrict__ cmds)
|
||||
|
@ -65,7 +65,7 @@ void PlaceVideoView::place()
|
||||
|
||||
bool PlaceVideoView::inputEvent(const Input::Event &e)
|
||||
{
|
||||
return visit(overloaded
|
||||
return e.visit(overloaded
|
||||
{
|
||||
[&](const Input::KeyEvent &e)
|
||||
{
|
||||
@ -150,7 +150,7 @@ bool PlaceVideoView::inputEvent(const Input::Event &e)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}, e);
|
||||
});
|
||||
}
|
||||
|
||||
void PlaceVideoView::draw(Gfx::RendererCommands &__restrict__ cmds)
|
||||
|
@ -1029,12 +1029,12 @@ void TouchConfigView::reloadItems()
|
||||
elem.name(app().inputManager), attachParams(),
|
||||
[this, &elem](const Input::Event &e)
|
||||
{
|
||||
visit(overloaded
|
||||
elem.visit(overloaded
|
||||
{
|
||||
[&](VControllerDPad &){ pushAndShow(makeView<DPadElementConfigView>(*this, vController, elem), e); },
|
||||
[&](VControllerButtonGroup &){ pushAndShow(makeView<ButtonGroupElementConfigView>(*this, vController, elem), e); },
|
||||
[](auto &){}
|
||||
}, elem);
|
||||
});
|
||||
});
|
||||
item.emplace_back(&i);
|
||||
}
|
||||
@ -1045,11 +1045,11 @@ void TouchConfigView::reloadItems()
|
||||
elem.name(app().inputManager), attachParams(),
|
||||
[this, &elem](const Input::Event &e)
|
||||
{
|
||||
visit(overloaded
|
||||
elem.visit(overloaded
|
||||
{
|
||||
[&](VControllerUIButtonGroup &){ pushAndShow(makeView<ButtonGroupElementConfigView>(*this, vController, elem), e); },
|
||||
[](auto &){}
|
||||
}, elem);
|
||||
});
|
||||
});
|
||||
item.emplace_back(&i);
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ int VController::yMMSizeToPixel(const IG::Window &win, float mm) const
|
||||
|
||||
static void updateTexture(const EmuApp &app, VControllerElement &e, Gfx::RendererTask &task, const Gfx::IndexBuffer<uint8_t> &fanQuadIdxs)
|
||||
{
|
||||
visit(overloaded
|
||||
e.visit(overloaded
|
||||
{
|
||||
[&](VControllerDPad &dpad){ dpad.setImage(task, app.asset(app.vControllerAssetDesc(0)), fanQuadIdxs); },
|
||||
[&](VControllerButtonGroup &grp)
|
||||
@ -109,7 +109,7 @@ static void updateTexture(const EmuApp &app, VControllerElement &e, Gfx::Rendere
|
||||
}
|
||||
grp.setTask(task);
|
||||
}
|
||||
}, e);
|
||||
});
|
||||
}
|
||||
|
||||
void VController::updateTextures()
|
||||
@ -121,12 +121,12 @@ void VController::updateTextures()
|
||||
static void setSize(VControllerElement &elem, int sizePx, Gfx::Renderer &r)
|
||||
{
|
||||
assert(sizePx);
|
||||
visit(overloaded
|
||||
elem.visit(overloaded
|
||||
{
|
||||
[&](VControllerDPad &dpad){ dpad.setSize(r, makeEvenRoundedUp(int(sizePx * 2.5f))); },
|
||||
[&](VControllerButtonGroup &grp){ grp.setButtonSize(sizePx); },
|
||||
[&](VControllerUIButtonGroup &grp){ grp.setButtonSize(sizePx); },
|
||||
}, elem);
|
||||
});
|
||||
}
|
||||
|
||||
void VController::setButtonSizes(int gamepadBtnSizeInPixels, int uiBtnSizeInPixels)
|
||||
@ -206,7 +206,7 @@ std::array<KeyInfo, 2> VController::findGamepadElements(WPt pos)
|
||||
{
|
||||
for(const auto &gpElem : gpElements)
|
||||
{
|
||||
auto indices = visit(overloaded
|
||||
auto indices = gpElem.visit(overloaded
|
||||
{
|
||||
[&](const VControllerDPad &dpad) -> std::array<KeyInfo, 2>
|
||||
{
|
||||
@ -221,7 +221,7 @@ std::array<KeyInfo, 2> VController::findGamepadElements(WPt pos)
|
||||
return grp.findButtonIndices(pos);
|
||||
},
|
||||
[](auto &e) -> std::array<KeyInfo, 2> { return {}; }
|
||||
}, gpElem);
|
||||
});
|
||||
if(indices != std::array<KeyInfo, 2>{})
|
||||
return indices;
|
||||
}
|
||||
@ -435,11 +435,11 @@ void VController::setDisabledInputKeys(std::span<const KeyCode> disabledKeys_)
|
||||
disabledKeys = disabledKeys_;
|
||||
for(auto &e : gpElements)
|
||||
{
|
||||
visit(overloaded
|
||||
e.visit(overloaded
|
||||
{
|
||||
[&](VControllerButtonGroup &grp) { updateEnabledButtons(grp); },
|
||||
[](auto &e){}
|
||||
}, e);
|
||||
});
|
||||
}
|
||||
place();
|
||||
}
|
||||
@ -701,7 +701,7 @@ bool VController::readConfig(EmuApp &app, MapIO &io, unsigned key)
|
||||
static void writeToConfig(const VControllerElement &e, FileIO &io)
|
||||
{
|
||||
io.put(e.dPad() ? int8_t(1) : int8_t(0));
|
||||
visit(overloaded
|
||||
e.visit(overloaded
|
||||
{
|
||||
[&](const VControllerButtonGroup &e)
|
||||
{
|
||||
@ -734,7 +734,7 @@ static void writeToConfig(const VControllerElement &e, FileIO &io)
|
||||
io.put(config.deadzoneMM100x);
|
||||
io.put(config.visualizeBounds);
|
||||
},
|
||||
}, e);
|
||||
});
|
||||
io.put(e.layoutPos[0].pos);
|
||||
io.put(e.layoutPos[0].origin.pack());
|
||||
io.put(e.layoutPos[1].pos);
|
||||
@ -1070,7 +1070,7 @@ void VController::updateSystemKeys(KeyInfo key, bool isPushed)
|
||||
};
|
||||
for(auto &e : gpElements)
|
||||
{
|
||||
visit(overloaded
|
||||
e.visit(overloaded
|
||||
{
|
||||
[&](VControllerButtonGroup &grp)
|
||||
{
|
||||
@ -1098,7 +1098,7 @@ void VController::updateSystemKeys(KeyInfo key, bool isPushed)
|
||||
dpad.setAlpha(alphaF);
|
||||
},
|
||||
[](auto &e){}
|
||||
}, e);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -1106,7 +1106,7 @@ void VController::resetHighlightedKeys()
|
||||
{
|
||||
for(auto &e : gpElements)
|
||||
{
|
||||
visit(overloaded
|
||||
e.visit(overloaded
|
||||
{
|
||||
[&](VControllerButtonGroup &grp)
|
||||
{
|
||||
@ -1120,7 +1120,7 @@ void VController::resetHighlightedKeys()
|
||||
}
|
||||
},
|
||||
[](auto &e){}
|
||||
}, e);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ class Gb_Apu
|
||||
// Sets buffer(s) to generate sound into. If left and right are NULL, output is mono.
|
||||
// If all are NULL, no output is generated but other emulation still runs.
|
||||
// If chan is specified, only that channel's output is changed, otherwise all are.
|
||||
enum { osc_count = 4 }; // 0: Square 1, 1: Square 2, 2: Wave, 3: Noise
|
||||
static constexpr int osc_count = 4; // 0: Square 1, 1: Square 2, 2: Wave, 3: Noise
|
||||
void set_output(Blip_Buffer *center, Blip_Buffer *left = NULL, Blip_Buffer *right = NULL,
|
||||
int chan = osc_count);
|
||||
|
||||
@ -34,9 +34,9 @@ class Gb_Apu
|
||||
|
||||
// Reads and writes must be within the start_addr to end_addr range, inclusive.
|
||||
// Addresses outside this range are not mapped to the sound hardware.
|
||||
enum { start_addr = 0xFF10 };
|
||||
enum { end_addr = 0xFF3F };
|
||||
enum { register_count = end_addr - start_addr + 1 };
|
||||
static constexpr unsigned start_addr = 0xFF10;
|
||||
static constexpr unsigned end_addr = 0xFF3F;
|
||||
static constexpr unsigned register_count = end_addr - start_addr + 1;
|
||||
|
||||
// Times are specified as the number of clocks since the beginning of the
|
||||
// current time frame.
|
||||
|
@ -125,8 +125,8 @@ class Gb_Sweep_Square : public Gb_Square
|
||||
}
|
||||
|
||||
private:
|
||||
enum { period_mask = 0x70 };
|
||||
enum { shift_mask = 0x07 };
|
||||
static constexpr unsigned period_mask = 0x70;
|
||||
static constexpr unsigned shift_mask = 0x07;
|
||||
|
||||
void calc_sweep(bool update);
|
||||
void reload_sweep_timer();
|
||||
|
@ -45,8 +45,8 @@ private:
|
||||
typedef std::list<SubResampler *> List;
|
||||
typedef SubResampler * (*CreateSinc)(unsigned div, float rollOffStart,
|
||||
float rollOffWidth, double gain);
|
||||
enum { big_sinc_mul = 2048 };
|
||||
enum { small_sinc_mul = 32 };
|
||||
static constexpr int big_sinc_mul = 2048;
|
||||
static constexpr int small_sinc_mul = 32;
|
||||
|
||||
List list_;
|
||||
SubResampler *bigSinc_;
|
||||
|
@ -23,15 +23,15 @@
|
||||
|
||||
namespace min_keeper_detail {
|
||||
|
||||
template<int n> struct CeiledLog2 { enum { r = 1 + CeiledLog2<(n + 1) / 2>::r }; };
|
||||
template<> struct CeiledLog2<1> { enum { r = 0 }; };
|
||||
template<int n> struct CeiledLog2 { static constexpr int r = 1 + CeiledLog2<(n + 1) / 2>::r; };
|
||||
template<> struct CeiledLog2<1> { static constexpr int r = 0; };
|
||||
|
||||
template<int v, int n> struct CeiledDiv2n { enum { r = CeiledDiv2n<(v + 1) / 2, n - 1>::r }; };
|
||||
template<int v> struct CeiledDiv2n<v, 0> { enum { r = v }; };
|
||||
// alternatively: template<int v, int n> struct CeiledDiv2n { enum { r = (v + (1 << n) - 1) >> n }; };
|
||||
template<int v, int n> struct CeiledDiv2n { static constexpr int r = CeiledDiv2n<(v + 1) / 2, n - 1>::r; };
|
||||
template<int v> struct CeiledDiv2n<v, 0> { static constexpr int r = v; };
|
||||
// alternatively: template<int v, int n> struct CeiledDiv2n { static constexpr int r = (v + (1 << n) - 1) >> n; };
|
||||
|
||||
template<template<int> class T, int n> struct Sum { enum { r = T<n-1>::r + Sum<T, n-1>::r }; };
|
||||
template<template<int> class T> struct Sum<T, 0> { enum { r = 0 }; };
|
||||
template<template<int> class T, int n> struct Sum { static constexpr int r = T<n-1>::r + Sum<T, n-1>::r; };
|
||||
template<template<int> class T> struct Sum<T, 0> { static constexpr int r = 0; };
|
||||
|
||||
}
|
||||
|
||||
|
@ -32,10 +32,10 @@ struct SaveState;
|
||||
|
||||
class StateSaver {
|
||||
public:
|
||||
enum { ss_shift = 2 };
|
||||
enum { ss_div = 1 << 2 };
|
||||
enum { ss_width = 160 >> ss_shift };
|
||||
enum { ss_height = 144 >> ss_shift };
|
||||
static constexpr int ss_shift = 2;
|
||||
static constexpr int ss_div = 1 << 2;
|
||||
static constexpr int ss_width = 160 >> ss_shift;
|
||||
static constexpr int ss_height = 144 >> ss_shift;
|
||||
|
||||
static bool saveState(SaveState const &state,
|
||||
uint_least32_t const *videoBuf, std::ptrdiff_t pitch,
|
||||
|
@ -20,14 +20,14 @@ enum {
|
||||
lcdstat_m2irqen = 0x20,
|
||||
lcdstat_lycirqen = 0x40 };
|
||||
|
||||
enum {
|
||||
constexpr int
|
||||
lcd_hres = 160,
|
||||
lcd_vres = 144,
|
||||
lcd_lines_per_frame = 154,
|
||||
lcd_max_num_sprites_per_line = 10,
|
||||
lcd_num_oam_entries = 40,
|
||||
lcd_cycles_per_line = 456,
|
||||
lcd_force_signed_enum1 = -1 };
|
||||
lcd_force_signed_enum1 = -1;
|
||||
enum {
|
||||
lcd_cycles_per_frame = 1l * lcd_lines_per_frame * lcd_cycles_per_line,
|
||||
lcd_force_signed_enum2 = -1 };
|
||||
|
@ -97,8 +97,8 @@ namespace StartWindowDraw {
|
||||
|
||||
#undef DECLARE_FUNC
|
||||
|
||||
enum { attr_cgbpalno = 0x07, attr_tdbank = 0x08, attr_dmgpalno = 0x10, attr_xflip = 0x20,
|
||||
attr_yflip = 0x40, attr_bgpriority = 0x80 };
|
||||
constexpr unsigned attr_cgbpalno = 0x07, attr_tdbank = 0x08, attr_dmgpalno = 0x10, attr_xflip = 0x20,
|
||||
attr_yflip = 0x40, attr_bgpriority = 0x80;
|
||||
enum { win_draw_start = 1, win_draw_started = 2 };
|
||||
|
||||
int const max_m3start_cycles = 80;
|
||||
|
@ -28,10 +28,10 @@
|
||||
|
||||
namespace gambatte {
|
||||
|
||||
enum {
|
||||
constexpr int
|
||||
max_num_palettes = 8,
|
||||
num_palette_entries = 4,
|
||||
ppu_force_signed_enum = -1 };
|
||||
ppu_force_signed_enum = -1;
|
||||
|
||||
class PPUFrameBuf {
|
||||
public:
|
||||
|
@ -103,7 +103,7 @@ private:
|
||||
bool cgb_;
|
||||
};
|
||||
|
||||
enum { need_sorting_flag = 0x80 };
|
||||
static constexpr unsigned need_sorting_flag = 0x80;
|
||||
|
||||
mutable unsigned char spritemap_[lcd_vres][lcd_max_num_sprites_per_line];
|
||||
mutable unsigned char num_[lcd_vres];
|
||||
|
@ -17,12 +17,12 @@ details. You should have received a copy of the GNU Lesser General Public
|
||||
License along with this module; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||
|
||||
enum { buf_extra = 2 }; /* extra samples to save past end */
|
||||
enum { time_bits = 16 }; /* bits in fraction of fixed-point sample counts */
|
||||
enum { time_unit = 1 << time_bits };
|
||||
enum { phase_bits = 15 }; /* bits in fraction of deltas in buffer */
|
||||
enum { phase_count = 1 << phase_bits };
|
||||
enum { phase_shift = time_bits - phase_bits };
|
||||
constexpr int buf_extra = 2; /* extra samples to save past end */
|
||||
constexpr int time_bits = 16; /* bits in fraction of fixed-point sample counts */
|
||||
constexpr int time_unit = 1 << time_bits;
|
||||
constexpr int phase_bits = 15; /* bits in fraction of deltas in buffer */
|
||||
constexpr int phase_count = 1 << phase_bits;
|
||||
constexpr int phase_shift = time_bits - phase_bits;
|
||||
|
||||
typedef int buf_t; /* type of element in delta buffer */
|
||||
|
||||
|
Binary file not shown.
BIN
NES.emu/res/palette/Palightful.pal
Normal file
BIN
NES.emu/res/palette/Palightful.pal
Normal file
Binary file not shown.
@ -329,6 +329,7 @@ class CustomVideoOptionView : public VideoOptionView, public MainAppHelper
|
||||
static constexpr auto classicPalPath = "Classic (FBX).pal";
|
||||
static constexpr auto wavebeamPalPath = "Wavebeam.pal";
|
||||
static constexpr auto lightfulPalPath = "Lightful.pal";
|
||||
static constexpr auto palightfulPalPath = "Palightful.pal";
|
||||
|
||||
void setPalette(IG::ApplicationContext ctx, IG::CStringView palPath)
|
||||
{
|
||||
@ -346,21 +347,19 @@ class CustomVideoOptionView : public VideoOptionView, public MainAppHelper
|
||||
return lastIndex(defaultPalItem);
|
||||
}
|
||||
|
||||
TextMenuItem defaultPalItem[8]
|
||||
TextMenuItem defaultPalItem[9]
|
||||
{
|
||||
{"FCEUX", attachParams(), [this](){ setPalette(appContext(), ""); }},
|
||||
{"FCEUX", attachParams(), [this]() { setPalette(appContext(), ""); }},
|
||||
{"Digital Prime (FBX)", attachParams(), [this]() { setPalette(appContext(), digitalPrimePalPath); }},
|
||||
{"Smooth V2 (FBX)", attachParams(), [this]() { setPalette(appContext(), smoothPalPath); }},
|
||||
{"Magnum (FBX)", attachParams(), [this]() { setPalette(appContext(), magnumPalPath); }},
|
||||
{"Classic (FBX)", attachParams(), [this]() { setPalette(appContext(), classicPalPath); }},
|
||||
{"Wavebeam", attachParams(), [this]() { setPalette(appContext(), wavebeamPalPath); }},
|
||||
{"Lightful", attachParams(), [this]() { setPalette(appContext(), lightfulPalPath); }},
|
||||
{"Custom File", attachParams(), [this](TextMenuItem &, View &, Input::Event e)
|
||||
{"Smooth V2 (FBX)", attachParams(), [this]() { setPalette(appContext(), smoothPalPath); }},
|
||||
{"Magnum (FBX)", attachParams(), [this]() { setPalette(appContext(), magnumPalPath); }},
|
||||
{"Classic (FBX)", attachParams(), [this]() { setPalette(appContext(), classicPalPath); }},
|
||||
{"Wavebeam", attachParams(), [this]() { setPalette(appContext(), wavebeamPalPath); }},
|
||||
{"Lightful", attachParams(), [this]() { setPalette(appContext(), lightfulPalPath); }},
|
||||
{"Palightful", attachParams(), [this]() { setPalette(appContext(), palightfulPalPath); }},
|
||||
{"Custom File", attachParams(), [this](Input::Event e)
|
||||
{
|
||||
auto fsFilter = [](std::string_view name)
|
||||
{
|
||||
return IG::endsWithAnyCaseless(name, ".pal");
|
||||
};
|
||||
auto fsFilter = [](std::string_view name) { return endsWithAnyCaseless(name, ".pal"); };
|
||||
auto fPicker = makeView<FilePicker>(FSPicker::Mode::FILE, fsFilter, e, false);
|
||||
fPicker->setOnSelectPath(
|
||||
[this](FSPicker &picker, IG::CStringView path, std::string_view name, Input::Event)
|
||||
@ -388,6 +387,7 @@ class CustomVideoOptionView : public VideoOptionView, public MainAppHelper
|
||||
if(system().defaultPalettePath == classicPalPath) return 4;
|
||||
if(system().defaultPalettePath == wavebeamPalPath) return 5;
|
||||
if(system().defaultPalettePath == lightfulPalPath) return 6;
|
||||
if(system().defaultPalettePath == palightfulPalPath) return 7;
|
||||
return (int)defaultPaletteCustomFileIdx();
|
||||
}(),
|
||||
defaultPalItem,
|
||||
|
@ -15,14 +15,14 @@ class alignas(128) HuC6280
|
||||
typedef uint8 (MDFN_FASTCALL *readfunc)(uint32 A);
|
||||
typedef int32 (MDFN_FASTCALL *ehfunc)(const int32 timestamp);
|
||||
|
||||
enum { N_FLAG = 0x80 };
|
||||
enum { V_FLAG = 0x40 };
|
||||
enum { T_FLAG = 0x20 };
|
||||
enum { B_FLAG = 0x10 };
|
||||
enum { D_FLAG = 0x08 };
|
||||
enum { I_FLAG = 0x04 };
|
||||
enum { Z_FLAG = 0x02 };
|
||||
enum { C_FLAG = 0x01 };
|
||||
static constexpr unsigned N_FLAG = 0x80;
|
||||
static constexpr unsigned V_FLAG = 0x40;
|
||||
static constexpr unsigned T_FLAG = 0x20;
|
||||
static constexpr unsigned B_FLAG = 0x10;
|
||||
static constexpr unsigned D_FLAG = 0x08;
|
||||
static constexpr unsigned I_FLAG = 0x04;
|
||||
static constexpr unsigned Z_FLAG = 0x02;
|
||||
static constexpr unsigned C_FLAG = 0x01;
|
||||
|
||||
// If emulate_wai is true, then the "0xCB" opcode will be handled by waiting for the next high-level event, NOT
|
||||
// for the IRQ line to be asserted as on a 65816.
|
||||
@ -35,10 +35,10 @@ class alignas(128) HuC6280
|
||||
void Reset(void) MDFN_COLD;
|
||||
void Power(void) MDFN_COLD;
|
||||
|
||||
enum { IQIRQ1 = 0x002 };
|
||||
enum { IQIRQ2 = 0x001 };
|
||||
enum { IQTIMER = 0x004 };
|
||||
enum { IQRESET = 0x020 };
|
||||
static constexpr unsigned IQIRQ1 = 0x002;
|
||||
static constexpr unsigned IQIRQ2 = 0x001;
|
||||
static constexpr unsigned IQTIMER = 0x004;
|
||||
static constexpr unsigned IQRESET = 0x020;
|
||||
|
||||
INLINE void IRQBegin(int w)
|
||||
{
|
||||
|
@ -117,8 +117,7 @@ class SH7095 final
|
||||
INLINE uint64 GetMAC64(void) { return MACL | ((uint64)MACH << 32); }
|
||||
INLINE void SetMAC64(uint64 nv) { MACL = nv; MACH = nv >> 32; }
|
||||
|
||||
enum // must be in range of 0 ... 7
|
||||
{
|
||||
static constexpr int // must be in range of 0 ... 7
|
||||
PEX_POWERON = 0,
|
||||
PEX_RESET = 1,
|
||||
PEX_CPUADDR = 2,
|
||||
@ -126,10 +125,9 @@ class SH7095 final
|
||||
PEX_INT = 4,
|
||||
PEX_NMI = 5,
|
||||
PEX_PSEUDO_DMABURST = 6,
|
||||
PEX_PSEUDO_EXTHALT = 7
|
||||
};
|
||||
enum { EPENDING_PEXBITS_SHIFT = 16 };
|
||||
enum { EPENDING_OP_OR = 0xFF000000 };
|
||||
PEX_PSEUDO_EXTHALT = 7;
|
||||
static constexpr int EPENDING_PEXBITS_SHIFT = 16;
|
||||
static constexpr unsigned EPENDING_OP_OR = 0xFF000000;
|
||||
|
||||
uint32 EPending;
|
||||
|
||||
|
@ -1955,8 +1955,8 @@ static MDFN_COLD void LoadRTC(void)
|
||||
|
||||
struct EventsPacker
|
||||
{
|
||||
enum : size_t { eventcopy_first = SS_EVENT__SYNFIRST + 1 };
|
||||
enum : size_t { eventcopy_bound = SS_EVENT__SYNLAST };
|
||||
static constexpr size_t eventcopy_first = SS_EVENT__SYNFIRST + 1;
|
||||
static constexpr size_t eventcopy_bound = SS_EVENT__SYNLAST;
|
||||
|
||||
bool Restore(const unsigned state_version);
|
||||
void Save(void);
|
||||
|
@ -30,8 +30,7 @@ using namespace Mednafen;
|
||||
|
||||
namespace MDFN_IEN_SS
|
||||
{
|
||||
enum
|
||||
{
|
||||
constexpr unsigned
|
||||
SS_DBG_ERROR = (1U << 0),
|
||||
SS_DBG_WARNING = (1U << 1),
|
||||
|
||||
@ -69,8 +68,7 @@ namespace MDFN_IEN_SS
|
||||
|
||||
SS_DBG_SCSP = (1U << 26),
|
||||
SS_DBG_SCSP_REGW = (1U << 27),
|
||||
SS_DBG_SCSP_MOBUF= (1U << 28),
|
||||
};
|
||||
SS_DBG_SCSP_MOBUF= (1U << 28);
|
||||
#ifdef MDFN_ENABLE_DEV_BUILD
|
||||
MDFN_HIDE extern uint32 ss_dbg_mask;
|
||||
#else
|
||||
|
@ -53,10 +53,10 @@ MDFN_HIDE extern int32 LocalX, LocalY;
|
||||
|
||||
MDFN_HIDE extern uint32 (MDFN_FASTCALL *const TexFetchTab[0x20])(uint32 x);
|
||||
|
||||
enum { TVMR_8BPP = 0x1 };
|
||||
enum { TVMR_ROTATE = 0x2 };
|
||||
enum { TVMR_HDTV = 0x4 };
|
||||
enum { TVMR_VBE = 0x8 };
|
||||
constexpr unsigned TVMR_8BPP = 0x1;
|
||||
constexpr unsigned TVMR_ROTATE = 0x2;
|
||||
constexpr unsigned TVMR_HDTV = 0x4;
|
||||
constexpr unsigned TVMR_VBE = 0x8;
|
||||
MDFN_HIDE extern uint8 TVMR;
|
||||
|
||||
enum { FBCR_FCT = 0x01 }; // Frame buffer change trigger
|
||||
|
@ -41,7 +41,7 @@ prefix ?= $(IMAGINE_SDK_PLATFORM_PATH)
|
||||
imaginePkgconfigTemplate := $(IMAGINE_PATH)/pkgconfig/imagine.pc
|
||||
pkgName := $(libName)
|
||||
pkgDescription := Game/Multimedia Engine
|
||||
pkgVersion := 1.5.81
|
||||
pkgVersion := 1.5.82
|
||||
LDLIBS := -l$(libName) $(LDLIBS)
|
||||
ifdef libNameExt
|
||||
pkgCFlags := -DIMAGINE_CONFIG_H=$(configFilename)
|
||||
|
@ -1,41 +0,0 @@
|
||||
ifndef CHOST
|
||||
CHOST := $(shell $(CC) -dumpmachine)
|
||||
endif
|
||||
|
||||
freetypeVer := 2.4.11
|
||||
freetypeSrcDir := $(tempDir)/freetype-$(freetypeVer)
|
||||
freetypeSrcArchive := freetype-$(freetypeVer).tar.bz2
|
||||
|
||||
makeFile := $(buildDir)/Makefile
|
||||
outputLibFile := $(buildDir)/.libs/libfreetype.a
|
||||
installIncludeDir := $(installDir)/include
|
||||
|
||||
all : $(outputLibFile)
|
||||
|
||||
$(freetypeSrcDir)/configure : | $(freetypeSrcArchive)
|
||||
@echo "Extracting freetype..."
|
||||
@mkdir -p $(freetypeSrcDir)
|
||||
tar -mxjf $| -C $(freetypeSrcDir)/..
|
||||
cd $(freetypeSrcDir) && patch -p1 < ../freetype.patch
|
||||
|
||||
install : $(outputLibFile)
|
||||
@echo "Installing freetype to: $(installDir)"
|
||||
@mkdir -p $(installIncludeDir) $(installDir)/lib/pkgconfig
|
||||
cp $(outputLibFile) $(installDir)/lib/
|
||||
cp -r $(freetypeSrcDir)/include/* $(installIncludeDir)/
|
||||
cp $(buildDir)/freetype2.pc $(installDir)/lib/pkgconfig/
|
||||
|
||||
.PHONY : all install
|
||||
|
||||
$(outputLibFile) : $(makeFile)
|
||||
@echo "Building freetype..."
|
||||
$(MAKE) -C $(<D)
|
||||
|
||||
$(makeFile) : $(freetypeSrcDir)/configure
|
||||
@echo "Configuring freetype..."
|
||||
@mkdir -p $(@D)
|
||||
dir=`pwd` && cd $(@D) && CC="$(CC)" CFLAGS="$(CPPFLAGS) $(CFLAGS)" LDFLAGS="$(LDFLAGS) $(LDLIBS)" \
|
||||
$(freetypeSrcDir)/configure --prefix='$${pcfiledir}/../..' --disable-shared --without-old-mac-fonts \
|
||||
--without-bzip2 --host=$(CHOST)
|
||||
|
||||
|
@ -1,2 +0,0 @@
|
||||
LTO_MODE ?= lto-fat
|
||||
pkgName := freetype
|
Binary file not shown.
@ -1,343 +0,0 @@
|
||||
diff -burp freetype-2.4.10/include/freetype/config/ftoption.h freetype-2.4.10-patched/include/freetype/config/ftoption.h
|
||||
--- freetype-2.4.10/include/freetype/config/ftoption.h 2012-06-14 01:35:58.000000000 -0400
|
||||
+++ freetype-2.4.10-patched/include/freetype/config/ftoption.h 2012-08-15 13:19:43.000000000 -0400
|
||||
@@ -148,7 +148,7 @@ FT_BEGIN_HEADER
|
||||
/* */
|
||||
/* Define this macro if you want to enable this `feature'. */
|
||||
/* */
|
||||
-#define FT_CONFIG_OPTION_USE_LZW
|
||||
+/*#define FT_CONFIG_OPTION_USE_LZW*/
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
@@ -163,7 +163,7 @@ FT_BEGIN_HEADER
|
||||
/* Define this macro if you want to enable this `feature'. See also */
|
||||
/* the macro FT_CONFIG_OPTION_SYSTEM_ZLIB below. */
|
||||
/* */
|
||||
-#define FT_CONFIG_OPTION_USE_ZLIB
|
||||
+/*#define FT_CONFIG_OPTION_USE_ZLIB*/
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
@@ -278,7 +278,7 @@ FT_BEGIN_HEADER
|
||||
/* You would normally undefine this configuration macro when building */
|
||||
/* a version of FreeType that doesn't contain a Type 1 or CFF driver. */
|
||||
/* */
|
||||
-#define FT_CONFIG_OPTION_POSTSCRIPT_NAMES
|
||||
+/*#define FT_CONFIG_OPTION_POSTSCRIPT_NAMES*/
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
@@ -296,7 +296,7 @@ FT_BEGIN_HEADER
|
||||
/* able to synthesize a Unicode charmap out of the glyphs found in the */
|
||||
/* fonts. */
|
||||
/* */
|
||||
-#define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
|
||||
+/*#define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST*/
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
@@ -309,7 +309,7 @@ FT_BEGIN_HEADER
|
||||
/* */
|
||||
/* Note that the `FOND' resource isn't checked. */
|
||||
/* */
|
||||
-#define FT_CONFIG_OPTION_MAC_FONTS
|
||||
+/*#define FT_CONFIG_OPTION_MAC_FONTS*/
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
@@ -343,7 +343,7 @@ FT_BEGIN_HEADER
|
||||
/* supply font data incrementally as the document is parsed, such */
|
||||
/* as the Ghostscript interpreter for the PostScript language. */
|
||||
/* */
|
||||
-#define FT_CONFIG_OPTION_INCREMENTAL
|
||||
+/*#define FT_CONFIG_OPTION_INCREMENTAL*/
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
@@ -365,7 +365,7 @@ FT_BEGIN_HEADER
|
||||
/* The maximum number of modules that can be registered in a single */
|
||||
/* FreeType library object. 32 is the default. */
|
||||
/* */
|
||||
-#define FT_MAX_MODULES 32
|
||||
+#define FT_MAX_MODULES 8
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
@@ -502,7 +502,7 @@ FT_BEGIN_HEADER
|
||||
/* */
|
||||
/* (By default, the module uses `PSNames' to extract glyph names.) */
|
||||
/* */
|
||||
-#define TT_CONFIG_OPTION_POSTSCRIPT_NAMES
|
||||
+/*#define TT_CONFIG_OPTION_POSTSCRIPT_NAMES*/
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
@@ -516,7 +516,7 @@ FT_BEGIN_HEADER
|
||||
/* Accessing SFNT names is done through the functions declared in */
|
||||
/* `freetype/ftsnames.h'. */
|
||||
/* */
|
||||
-#define TT_CONFIG_OPTION_SFNT_NAMES
|
||||
+/*#define TT_CONFIG_OPTION_SFNT_NAMES*/
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
@@ -647,7 +647,7 @@ FT_BEGIN_HEADER
|
||||
/* and avar tables). This has many similarities to Type 1 Multiple */
|
||||
/* Masters support. */
|
||||
/* */
|
||||
-#define TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||
+/*#define TT_CONFIG_OPTION_GX_VAR_SUPPORT*/
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
@@ -655,7 +655,7 @@ FT_BEGIN_HEADER
|
||||
/* Define TT_CONFIG_OPTION_BDF if you want to include support for */
|
||||
/* an embedded `BDF ' table within SFNT-based bitmap formats. */
|
||||
/* */
|
||||
-#define TT_CONFIG_OPTION_BDF
|
||||
+/*#define TT_CONFIG_OPTION_BDF*/
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
@@ -733,7 +733,7 @@ FT_BEGIN_HEADER
|
||||
/* */
|
||||
/* Compile autofit module with Indic script support. */
|
||||
/* */
|
||||
-#define AF_CONFIG_OPTION_INDIC
|
||||
+/*#define AF_CONFIG_OPTION_INDIC*/
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
@@ -761,7 +761,7 @@ FT_BEGIN_HEADER
|
||||
* is recommended to disable the macro since it reduces the library's code
|
||||
* size and activates a few memory-saving optimizations as well.
|
||||
*/
|
||||
-#define FT_CONFIG_OPTION_OLD_INTERNALS
|
||||
+/*#define FT_CONFIG_OPTION_OLD_INTERNALS*/
|
||||
|
||||
|
||||
/*
|
||||
diff -burp freetype-2.4.10/modules.cfg freetype-2.4.10-patched/modules.cfg
|
||||
--- freetype-2.4.10/modules.cfg 2011-11-26 07:19:10.000000000 -0500
|
||||
+++ freetype-2.4.10-patched/modules.cfg 2012-08-15 13:15:25.000000000 -0400
|
||||
@@ -37,35 +37,35 @@ FONT_MODULES += truetype
|
||||
# PostScript Type 1 font driver.
|
||||
#
|
||||
# This driver needs the `psaux', `pshinter', and `psnames' modules.
|
||||
-FONT_MODULES += type1
|
||||
+#FONT_MODULES += type1
|
||||
|
||||
# CFF/OpenType font driver.
|
||||
#
|
||||
# This driver needs the `sfnt', `pshinter', and `psnames' modules.
|
||||
-FONT_MODULES += cff
|
||||
+#FONT_MODULES += cff
|
||||
|
||||
# Type 1 CID-keyed font driver.
|
||||
#
|
||||
# This driver needs the `psaux', `pshinter', and `psnames' modules.
|
||||
-FONT_MODULES += cid
|
||||
+#FONT_MODULES += cid
|
||||
|
||||
# PFR/TrueDoc font driver. See optional extension ftpfr.c below also.
|
||||
-FONT_MODULES += pfr
|
||||
+#FONT_MODULES += pfr
|
||||
|
||||
# PostScript Type 42 font driver.
|
||||
#
|
||||
-# This driver needs the `truetype' and `psaux' modules.
|
||||
-FONT_MODULES += type42
|
||||
+# This driver needs the `truetype' module.
|
||||
+#FONT_MODULES += type42
|
||||
|
||||
# Windows FONT/FNT font driver. See optional extension ftwinfnt.c below
|
||||
# also.
|
||||
-FONT_MODULES += winfonts
|
||||
+#FONT_MODULES += winfonts
|
||||
|
||||
# PCF font driver.
|
||||
-FONT_MODULES += pcf
|
||||
+#FONT_MODULES += pcf
|
||||
|
||||
# BDF font driver. See optional extension ftbdf.c below also.
|
||||
-FONT_MODULES += bdf
|
||||
+#FONT_MODULES += bdf
|
||||
|
||||
# SFNT files support. If used without `truetype' or `cff', it supports
|
||||
# bitmap-only fonts within an SFNT wrapper.
|
||||
@@ -79,10 +79,10 @@ FONT_MODULES += sfnt
|
||||
####
|
||||
|
||||
# FreeType's auto hinter.
|
||||
-HINTING_MODULES += autofit
|
||||
+#HINTING_MODULES += autofit
|
||||
|
||||
# PostScript hinter.
|
||||
-HINTING_MODULES += pshinter
|
||||
+#HINTING_MODULES += pshinter
|
||||
|
||||
# The TrueType hinting engine doesn't have a module of its own but is
|
||||
# controlled in file include/freetype/config/ftoption.h
|
||||
@@ -94,7 +94,7 @@ HINTING_MODULES += pshinter
|
||||
####
|
||||
|
||||
# Monochrome rasterizer.
|
||||
-RASTER_MODULES += raster
|
||||
+#RASTER_MODULES += raster
|
||||
|
||||
# Anti-aliasing rasterizer.
|
||||
RASTER_MODULES += smooth
|
||||
@@ -107,7 +107,7 @@ RASTER_MODULES += smooth
|
||||
# FreeType's cache sub-system (quite stable but still in beta -- this means
|
||||
# that its public API is subject to change if necessary). See
|
||||
# include/freetype/ftcache.h. Needs ftglyph.c.
|
||||
-AUX_MODULES += cache
|
||||
+#AUX_MODULES += cache
|
||||
|
||||
# TrueType GX/AAT table validation. Needs ftgxval.c below.
|
||||
# AUX_MODULES += gxvalid
|
||||
@@ -115,17 +115,17 @@ AUX_MODULES += cache
|
||||
# Support for streams compressed with gzip (files with suffix .gz).
|
||||
#
|
||||
# See include/freetype/ftgzip.h for the API.
|
||||
-AUX_MODULES += gzip
|
||||
+#AUX_MODULES += gzip
|
||||
|
||||
# Support for streams compressed with LZW (files with suffix .Z).
|
||||
#
|
||||
# See include/freetype/ftlzw.h for the API.
|
||||
-AUX_MODULES += lzw
|
||||
+#AUX_MODULES += lzw
|
||||
|
||||
# Support for streams compressed with bzip2 (files with suffix .bz2).
|
||||
#
|
||||
# See include/freetype/ftbzip2.h for the API.
|
||||
-AUX_MODULES += bzip2
|
||||
+#AUX_MODULES += bzip2
|
||||
|
||||
# OpenType table validation. Needs ftotval.c below.
|
||||
#
|
||||
@@ -134,7 +134,7 @@ AUX_MODULES += bzip2
|
||||
# Auxiliary PostScript driver component to share common code.
|
||||
#
|
||||
# This module depends on `psnames'.
|
||||
-AUX_MODULES += psaux
|
||||
+#AUX_MODULES += psaux
|
||||
|
||||
# Support for PostScript glyph names.
|
||||
#
|
||||
@@ -150,95 +150,95 @@ AUX_MODULES += psnames
|
||||
# Exact bounding box calculation.
|
||||
#
|
||||
# See include/freetype/ftbbox.h for the API.
|
||||
-BASE_EXTENSIONS += ftbbox.c
|
||||
+#BASE_EXTENSIONS += ftbbox.c
|
||||
|
||||
# Access BDF-specific strings. Needs BDF font driver.
|
||||
#
|
||||
# See include/freetype/ftbdf.h for the API.
|
||||
-BASE_EXTENSIONS += ftbdf.c
|
||||
+#BASE_EXTENSIONS += ftbdf.c
|
||||
|
||||
# Utility functions for converting 1bpp, 2bpp, 4bpp, and 8bpp bitmaps into
|
||||
# 8bpp format, and for emboldening of bitmap glyphs.
|
||||
#
|
||||
# See include/freetype/ftbitmap.h for the API.
|
||||
-BASE_EXTENSIONS += ftbitmap.c
|
||||
+#BASE_EXTENSIONS += ftbitmap.c
|
||||
|
||||
# Access CID font information.
|
||||
#
|
||||
# See include/freetype/ftcid.h for the API.
|
||||
-BASE_EXTENSIONS += ftcid.c
|
||||
+#BASE_EXTENSIONS += ftcid.c
|
||||
|
||||
# Access FSType information. Needs fttype1.c.
|
||||
#
|
||||
# See include/freetype/freetype.h for the API.
|
||||
-BASE_EXTENSIONS += ftfstype.c
|
||||
+#BASE_EXTENSIONS += ftfstype.c
|
||||
|
||||
# Support for GASP table queries.
|
||||
#
|
||||
# See include/freetype/ftgasp.h for the API.
|
||||
-BASE_EXTENSIONS += ftgasp.c
|
||||
+#BASE_EXTENSIONS += ftgasp.c
|
||||
|
||||
# Convenience functions to handle glyphs. Needs ftbitmap.c.
|
||||
#
|
||||
# See include/freetype/ftglyph.h for the API.
|
||||
-BASE_EXTENSIONS += ftglyph.c
|
||||
+#BASE_EXTENSIONS += ftglyph.c
|
||||
|
||||
# Interface for gxvalid module.
|
||||
#
|
||||
# See include/freetype/ftgxval.h for the API.
|
||||
-BASE_EXTENSIONS += ftgxval.c
|
||||
+#BASE_EXTENSIONS += ftgxval.c
|
||||
|
||||
# Support for LCD color filtering of subpixel bitmaps.
|
||||
#
|
||||
# See include/freetype/ftlcdfil.h for the API.
|
||||
-BASE_EXTENSIONS += ftlcdfil.c
|
||||
+#BASE_EXTENSIONS += ftlcdfil.c
|
||||
|
||||
# Multiple Master font interface.
|
||||
#
|
||||
# See include/freetype/ftmm.h for the API.
|
||||
-BASE_EXTENSIONS += ftmm.c
|
||||
+#BASE_EXTENSIONS += ftmm.c
|
||||
|
||||
# Interface for otvalid module.
|
||||
#
|
||||
# See include/freetype/ftotval.h for the API.
|
||||
-BASE_EXTENSIONS += ftotval.c
|
||||
+#BASE_EXTENSIONS += ftotval.c
|
||||
|
||||
# Support for FT_Face_CheckTrueTypePatents.
|
||||
#
|
||||
# See include/freetype/freetype.h for the API.
|
||||
-BASE_EXTENSIONS += ftpatent.c
|
||||
+#BASE_EXTENSIONS += ftpatent.c
|
||||
|
||||
# Interface for accessing PFR-specific data. Needs PFR font driver.
|
||||
#
|
||||
# See include/freetype/ftpfr.h for the API.
|
||||
-BASE_EXTENSIONS += ftpfr.c
|
||||
+#BASE_EXTENSIONS += ftpfr.c
|
||||
|
||||
# Path stroker. Needs ftglyph.c.
|
||||
#
|
||||
# See include/freetype/ftstroke.h for the API.
|
||||
-BASE_EXTENSIONS += ftstroke.c
|
||||
+#BASE_EXTENSIONS += ftstroke.c
|
||||
|
||||
# Support for synthetic embolding and slanting of fonts. Needs ftbitmap.c.
|
||||
#
|
||||
# See include/freetype/ftsynth.h for the API.
|
||||
-BASE_EXTENSIONS += ftsynth.c
|
||||
+#BASE_EXTENSIONS += ftsynth.c
|
||||
|
||||
# Interface to access data specific to PostScript Type 1 and Type 2 (CFF)
|
||||
# fonts.
|
||||
#
|
||||
# See include/freetype/t1tables.h for the API.
|
||||
-BASE_EXTENSIONS += fttype1.c
|
||||
+#BASE_EXTENSIONS += fttype1.c
|
||||
|
||||
# Interface for accessing data specific to Windows FNT files. Needs winfnt
|
||||
# driver.
|
||||
#
|
||||
# See include/freetype/ftwinfnt.h for the API.
|
||||
-BASE_EXTENSIONS += ftwinfnt.c
|
||||
+#BASE_EXTENSIONS += ftwinfnt.c
|
||||
|
||||
# Support functions for X11.
|
||||
#
|
||||
# See include/freetype/ftxf86.h for the API.
|
||||
-BASE_EXTENSIONS += ftxf86.c
|
||||
+#BASE_EXTENSIONS += ftxf86.c
|
||||
|
||||
####
|
||||
#### The components `ftsystem.c' (for memory allocation and stream I/O
|
@ -1 +0,0 @@
|
||||
../../make/ps3.mk
|
@ -1 +0,0 @@
|
||||
../../make/win32-x86.mk
|
@ -34,6 +34,7 @@
|
||||
#include <imagine/audio/defs.hh>
|
||||
#include <imagine/time/Time.hh>
|
||||
#include <imagine/audio/Format.hh>
|
||||
#include <imagine/util/variant.hh>
|
||||
#include <variant>
|
||||
|
||||
namespace IG::Audio
|
||||
@ -79,11 +80,12 @@ using OutputStreamVariant = std::variant<CAOutputStream, NullOutputStream>;
|
||||
NullOutputStream>;
|
||||
#endif
|
||||
|
||||
class OutputStream : public OutputStreamVariant
|
||||
class OutputStream : public OutputStreamVariant, public AddVisit
|
||||
{
|
||||
public:
|
||||
using OutputStreamVariant::OutputStreamVariant;
|
||||
using OutputStreamVariant::operator=;
|
||||
using AddVisit::visit;
|
||||
|
||||
constexpr OutputStream(): OutputStreamVariant{std::in_place_type<NullOutputStream>} {}
|
||||
void setApi(const Manager &, Api api = Api::DEFAULT);
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include <imagine/base/MessagePort.hh>
|
||||
#include <imagine/input/Device.hh>
|
||||
#include <imagine/util/DelegateFuncSet.hh>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <cstdint>
|
||||
|
@ -23,14 +23,15 @@ namespace IG
|
||||
{
|
||||
|
||||
template <class VariantBase>
|
||||
class FrameTimerInterface : public VariantBase
|
||||
class FrameTimerInterface : public VariantBase, public AddVisit
|
||||
{
|
||||
public:
|
||||
using VariantBase::VariantBase;
|
||||
using AddVisit::visit;
|
||||
|
||||
void scheduleVSync() { visit([](auto &e){ e.scheduleVSync(); }, *this); }
|
||||
void cancel() { visit([](auto &e){ e.cancel(); }, *this); }
|
||||
void setFrameRate(FrameRate rate) { visit([&](auto &e){ e.setFrameRate(rate); }, *this); }
|
||||
void scheduleVSync() { visit([](auto &e){ e.scheduleVSync(); }); }
|
||||
void cancel() { visit([](auto &e){ e.cancel(); }); }
|
||||
void setFrameRate(FrameRate rate) { visit([&](auto &e){ e.setFrameRate(rate); }); }
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Imagine. If not, see <http://www.gnu.org/licenses/> */
|
||||
|
||||
#define IMAGINE_VERSION_BASE "1.5.81"
|
||||
#define IMAGINE_VERSION_BASE "1.5.82"
|
||||
|
||||
#ifdef NDEBUG
|
||||
#define IMAGINE_VERSION IMAGINE_VERSION_BASE
|
||||
|
@ -16,14 +16,12 @@
|
||||
along with Imagine. If not, see <http://www.gnu.org/licenses/> */
|
||||
|
||||
#include <imagine/config/defs.hh>
|
||||
#include <imagine/gui/ViewAttachParams.hh>
|
||||
#include <imagine/gui/ViewManager.hh>
|
||||
#include <imagine/gfx/GfxText.hh>
|
||||
#include <imagine/util/DelegateFunc.hh>
|
||||
#include <imagine/util/concepts.hh>
|
||||
#include <imagine/util/utility.h>
|
||||
#include <imagine/util/variant.hh>
|
||||
#include <vector>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
@ -36,6 +34,21 @@ class Event;
|
||||
namespace IG
|
||||
{
|
||||
|
||||
template<class Func, class... Args>
|
||||
constexpr bool callAndAutoReturnTrue(Func& f, Args&&... args)
|
||||
{
|
||||
if constexpr(VoidInvokeResult<Func, Args...>)
|
||||
{
|
||||
// auto-return true if the supplied function doesn't return a value
|
||||
f(std::forward<Args>(args)...);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return f(std::forward<Args>(args)...);
|
||||
}
|
||||
}
|
||||
|
||||
template <class Item>
|
||||
class MenuItemSelectDelegate : public DelegateFunc<bool (Item &, View &, const Input::Event &)>
|
||||
{
|
||||
@ -49,58 +62,44 @@ public:
|
||||
constexpr MenuItemSelectDelegate(Callable<void, Item &, View &, const Input::Event &> auto &&f):
|
||||
DelegateFuncBase
|
||||
{
|
||||
[=](Item &i, View &v, const Input::Event &e) { return callAndReturnBool(f, i, v, e); }
|
||||
[=](Item &i, View &v, const Input::Event &e) { return callAndAutoReturnTrue(f, i, v, e); }
|
||||
} {}
|
||||
|
||||
constexpr MenuItemSelectDelegate(std::invocable<Item &, const Input::Event &> auto &&f):
|
||||
DelegateFuncBase
|
||||
{
|
||||
[=](Item &i, View &v, const Input::Event &e) { return callAndReturnBool(f, i, e); }
|
||||
[=](Item &i, View &v, const Input::Event &e) { return callAndAutoReturnTrue(f, i, e); }
|
||||
} {}
|
||||
|
||||
constexpr MenuItemSelectDelegate(std::invocable<View &, const Input::Event &> auto &&f):
|
||||
DelegateFuncBase
|
||||
{
|
||||
[=](Item &i, View &v, const Input::Event &e) { return callAndReturnBool(f, v, e); }
|
||||
[=](Item &i, View &v, const Input::Event &e) { return callAndAutoReturnTrue(f, v, e); }
|
||||
} {}
|
||||
|
||||
constexpr MenuItemSelectDelegate(std::invocable<Item &> auto &&f):
|
||||
DelegateFuncBase
|
||||
{
|
||||
[=](Item &i, View &v, const Input::Event &e) { return callAndReturnBool(f, i); }
|
||||
[=](Item &i, View &v, const Input::Event &e) { return callAndAutoReturnTrue(f, i); }
|
||||
} {}
|
||||
|
||||
constexpr MenuItemSelectDelegate(std::invocable<View &> auto &&f):
|
||||
DelegateFuncBase
|
||||
{
|
||||
[=](Item &i, View &v, const Input::Event &e) { return callAndReturnBool(f, v); }
|
||||
[=](Item &i, View &v, const Input::Event &e) { return callAndAutoReturnTrue(f, v); }
|
||||
} {}
|
||||
|
||||
constexpr MenuItemSelectDelegate(std::invocable<const Input::Event &> auto &&f):
|
||||
DelegateFuncBase
|
||||
{
|
||||
[=](Item &i, View &v, const Input::Event &e) { return callAndReturnBool(f, e); }
|
||||
[=](Item &i, View &v, const Input::Event &e) { return callAndAutoReturnTrue(f, e); }
|
||||
} {}
|
||||
|
||||
constexpr MenuItemSelectDelegate(std::invocable auto &&f):
|
||||
DelegateFuncBase
|
||||
{
|
||||
[=](Item &i, View &v, const Input::Event &e) { return callAndReturnBool(f); }
|
||||
[=](Item &i, View &v, const Input::Event &e) { return callAndAutoReturnTrue(f); }
|
||||
} {}
|
||||
|
||||
constexpr static bool callAndReturnBool(auto &f, auto &&...args)
|
||||
{
|
||||
if constexpr(VoidInvokeResult<decltype(f), decltype(args)...>)
|
||||
{
|
||||
// auto-return true if the supplied function doesn't return a value
|
||||
f(IG_forward(args)...);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return f(IG_forward(args)...);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct MenuItemFlags
|
||||
|
@ -16,7 +16,6 @@
|
||||
along with Imagine. If not, see <http://www.gnu.org/licenses/> */
|
||||
|
||||
#include <imagine/gui/viewDefs.hh>
|
||||
#include <imagine/gui/ViewAttachParams.hh>
|
||||
#include <imagine/util/DelegateFunc.hh>
|
||||
#include <imagine/util/utility.h>
|
||||
#include <imagine/util/string/utf16.hh>
|
||||
|
@ -1,45 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
/* This file is part of Imagine.
|
||||
|
||||
Imagine is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Imagine is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Imagine. If not, see <http://www.gnu.org/licenses/> */
|
||||
|
||||
namespace IG
|
||||
{
|
||||
class Window;
|
||||
class ApplicationContext;
|
||||
}
|
||||
|
||||
namespace IG::Gfx
|
||||
{
|
||||
class Renderer;
|
||||
class RendererTask;
|
||||
}
|
||||
|
||||
namespace IG
|
||||
{
|
||||
|
||||
class ViewManager;
|
||||
|
||||
struct ViewAttachParams
|
||||
{
|
||||
ViewManager &viewManager;
|
||||
Window &window;
|
||||
Gfx::RendererTask &rendererTask;
|
||||
|
||||
Gfx::Renderer &renderer() const;
|
||||
ApplicationContext appContext() const;
|
||||
};
|
||||
|
||||
}
|
@ -33,13 +33,24 @@ constexpr auto imageSamplerConfig = Gfx::SamplerConfigs::nearestMipClamp;
|
||||
namespace IG
|
||||
{
|
||||
|
||||
class ApplicationContext;
|
||||
class Window;
|
||||
class View;
|
||||
class ViewController;
|
||||
struct ViewAttachParams;
|
||||
class ViewManager;
|
||||
class TableView;
|
||||
class MenuItem;
|
||||
|
||||
struct ViewAttachParams
|
||||
{
|
||||
ViewManager &viewManager;
|
||||
Window &window;
|
||||
Gfx::RendererTask &rendererTask;
|
||||
|
||||
Gfx::Renderer &renderer() const;
|
||||
ApplicationContext appContext() const;
|
||||
};
|
||||
|
||||
struct TableUIState
|
||||
{
|
||||
int highlightedCell{-1};
|
||||
|
@ -84,11 +84,12 @@ AppleGameDevice,
|
||||
NullDevice
|
||||
>;
|
||||
|
||||
class Device : public DeviceVariant
|
||||
class Device : public DeviceVariant, public AddVisit
|
||||
{
|
||||
public:
|
||||
using Subtype = DeviceSubtype;
|
||||
using DeviceVariant::DeviceVariant;
|
||||
using AddVisit::visit;
|
||||
|
||||
bool hasKeyboard() const { return typeFlags().keyboard; }
|
||||
bool hasGamepad() const { return typeFlags().gamepad; }
|
||||
@ -128,10 +129,10 @@ public:
|
||||
return k;
|
||||
}
|
||||
|
||||
int id() const { return visit([](auto &d){ return d.id_; }, *this); }
|
||||
uint8_t enumId() const { return visit([](auto &d){ return d.enumId_; }, *this); }
|
||||
void setEnumId(uint8_t id) { visit([&](auto &d){ d.enumId_ = id; }, *this); }
|
||||
std::string_view name() const { return visit([](auto &d){ return std::string_view{d.name_}; }, *this); }
|
||||
int id() const { return visit([](auto &d){ return d.id_; }); }
|
||||
uint8_t enumId() const { return visit([](auto &d){ return d.enumId_; }); }
|
||||
void setEnumId(uint8_t id) { visit([&](auto &d){ d.enumId_ = id; }); }
|
||||
std::string_view name() const { return visit([](auto &d){ return std::string_view{d.name_}; }); }
|
||||
Map map() const;
|
||||
DeviceTypeFlags typeFlags() const
|
||||
{
|
||||
@ -141,10 +142,10 @@ public:
|
||||
if(iCadeMode())
|
||||
flags.gamepad = true;
|
||||
return flags;
|
||||
}, *this);
|
||||
});
|
||||
}
|
||||
Subtype subtype() const { return visit([](auto &d){ return d.subtype_; }, *this); }
|
||||
void setSubtype(Subtype s) { visit([&](auto &d){ d.subtype_ = s; }, *this); }
|
||||
Subtype subtype() const { return visit([](auto &d){ return d.subtype_; }); }
|
||||
void setSubtype(Subtype s) { visit([&](auto &d){ d.subtype_ = s; }); }
|
||||
bool operator==(Device const&) const = default;
|
||||
void setJoystickAxesAsKeys(AxisSetId, bool on);
|
||||
bool joystickAxesAsKeys(AxisSetId);
|
||||
@ -159,7 +160,7 @@ public:
|
||||
template <class T>
|
||||
T &makeAppData(auto &&...args)
|
||||
{
|
||||
auto &appDataPtr = visit([&](auto &d) -> auto& { return d.appDataPtr; }, *this);
|
||||
auto &appDataPtr = visit([&](auto &d) -> auto& { return d.appDataPtr; });
|
||||
appDataPtr = std::make_shared<T>(IG_forward(args)...);
|
||||
return *appData<T>();
|
||||
}
|
||||
@ -167,7 +168,7 @@ public:
|
||||
template<class T>
|
||||
T *appData() const
|
||||
{
|
||||
return visit([&](auto &d){ return static_cast<T*>(d.appDataPtr.get()); }, *this);
|
||||
return visit([&](auto &d){ return static_cast<T*>(d.appDataPtr.get()); });
|
||||
}
|
||||
|
||||
// optional API
|
||||
@ -179,7 +180,7 @@ public:
|
||||
return d.motionAxes();
|
||||
else
|
||||
return std::span<Axis>{};
|
||||
}, *this);
|
||||
});
|
||||
}
|
||||
const char *keyName(Key k) const;
|
||||
void setICadeMode(bool on);
|
||||
|
@ -156,15 +156,16 @@ protected:
|
||||
|
||||
using EventVariant = std::variant<MotionEvent, KeyEvent>;
|
||||
|
||||
class Event : public EventVariant
|
||||
class Event : public EventVariant, public AddVisit
|
||||
{
|
||||
public:
|
||||
using EventVariant::EventVariant;
|
||||
using AddVisit::visit;
|
||||
|
||||
constexpr auto motionEvent(this auto&& self) { return std::get_if<MotionEvent>(&self); }
|
||||
constexpr auto keyEvent(this auto&& self) { return std::get_if<KeyEvent>(&self); }
|
||||
constexpr auto state() const { return visit([](auto &e){ return e.state(); }, *this); }
|
||||
constexpr auto metaKeyBits() const { return visit([](auto &e){ return e.metaKeyBits(); }, *this); }
|
||||
constexpr auto state() const { return visit([](auto &e){ return e.state(); }); }
|
||||
constexpr auto metaKeyBits() const { return visit([](auto &e){ return e.metaKeyBits(); }); }
|
||||
|
||||
SteadyClockTimePoint time() const;
|
||||
const Device *device() const;
|
||||
|
@ -21,6 +21,7 @@
|
||||
#ifdef __ANDROID__
|
||||
#include <imagine/io/AAssetIO.hh>
|
||||
#endif
|
||||
#include <imagine/util/variant.hh>
|
||||
#include <variant>
|
||||
#include <span>
|
||||
#include <optional>
|
||||
@ -36,11 +37,12 @@ AAssetIO,
|
||||
#endif
|
||||
ArchiveIO>;
|
||||
|
||||
class IO : public IOVariant, public IOUtils<IO>
|
||||
class IO : public IOVariant, public IOUtils<IO>, public AddVisit
|
||||
{
|
||||
public:
|
||||
using IOVariant::IOVariant;
|
||||
using IOVariant::operator=;
|
||||
using AddVisit::visit;
|
||||
using IOUtilsBase = IOUtils<IO>;
|
||||
using IOUtilsBase::read;
|
||||
using IOUtilsBase::write;
|
||||
|
@ -16,7 +16,7 @@
|
||||
along with Imagine. If not, see <http://www.gnu.org/licenses/> */
|
||||
|
||||
#include <imagine/util/concepts.hh>
|
||||
#include <imagine/util/utility.h>
|
||||
#include <utility>
|
||||
#include <new>
|
||||
#include <cstddef>
|
||||
#include <cassert>
|
||||
@ -49,7 +49,7 @@ public:
|
||||
{
|
||||
[](const Storage &funcObj, Args ...args) -> R
|
||||
{
|
||||
return ((F*)funcObj.data())->operator()(IG_forward(args)...);
|
||||
return ((F*)funcObj.data())->operator()(std::forward<Args>(args)...);
|
||||
}
|
||||
}
|
||||
{
|
||||
@ -64,7 +64,7 @@ public:
|
||||
{
|
||||
[](const Storage &funcObj, Args ...args) -> R
|
||||
{
|
||||
return (*((FreeFuncPtr*)funcObj.data()))(IG_forward(args)...);
|
||||
return (*((FreeFuncPtr*)funcObj.data()))(std::forward<Args>(args)...);
|
||||
}
|
||||
}
|
||||
{
|
||||
@ -78,33 +78,37 @@ public:
|
||||
return exec;
|
||||
}
|
||||
|
||||
constexpr R operator()(auto &&...args) const
|
||||
requires ValidInvokeArgs<FreeFuncPtr, decltype(args)...>
|
||||
template<class... CallArgs>
|
||||
constexpr R operator()(CallArgs&&... args) const
|
||||
requires ValidInvokeArgs<FreeFuncPtr, CallArgs...>
|
||||
{
|
||||
assert(exec);
|
||||
return exec(store, IG_forward(args)...);
|
||||
return exec(store, std::forward<CallArgs>(args)...);
|
||||
}
|
||||
|
||||
constexpr bool operator ==(DelegateFuncBase const&) const = default;
|
||||
|
||||
constexpr R callCopy(auto &&...args) const
|
||||
template<class... CallArgs>
|
||||
constexpr R callCopy(CallArgs&&... args) const
|
||||
{
|
||||
// Call a copy to avoid trashing captured variables
|
||||
// if delegate's function can modify the delegate
|
||||
return ({auto copy = *this; copy;})(IG_forward(args)...);
|
||||
return ({auto copy = *this; copy;})(std::forward<CallArgs>(args)...);
|
||||
}
|
||||
|
||||
constexpr R callSafe(auto &&...args) const
|
||||
template<class... CallArgs>
|
||||
constexpr R callSafe(CallArgs&&... args) const
|
||||
{
|
||||
if(exec)
|
||||
return this->operator()(IG_forward(args)...);
|
||||
return this->operator()(std::forward<CallArgs>(args)...);
|
||||
return R();
|
||||
}
|
||||
|
||||
constexpr R callCopySafe(auto &&...args) const
|
||||
template<class... CallArgs>
|
||||
constexpr R callCopySafe(CallArgs&&... args) const
|
||||
{
|
||||
if(exec)
|
||||
return callCopy(IG_forward(args)...);
|
||||
return callCopy(std::forward<CallArgs>(args)...);
|
||||
return R();
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ template<class... Ts> overloaded(Ts&&...) -> overloaded<std::decay_t<Ts>...>;
|
||||
// TODO: remove when clang implements a similar optimization,
|
||||
// currently Clang 14's libc++ uses a function jump table that prevents inline optimization
|
||||
template<class... VTypes, class Variant = std::variant<VTypes...>, auto vSize = std::variant_size_v<Variant>>
|
||||
constexpr decltype(auto) visitVariant(auto &&func, Variant &v)
|
||||
constexpr decltype(auto) visitVariant(auto&& func, Variant& v)
|
||||
requires (vSize <= 16)
|
||||
{
|
||||
#define VISIT_CASE(i) case i: \
|
||||
@ -60,26 +60,38 @@ constexpr decltype(auto) visitVariant(auto &&func, Variant &v)
|
||||
}
|
||||
|
||||
template <class... VTypes>
|
||||
constexpr decltype(auto) asVariant(std::variant<VTypes...> &v) noexcept { return v; }
|
||||
constexpr decltype(auto) asVariant(std::variant<VTypes...>& v) noexcept { return v; }
|
||||
|
||||
template <class... VTypes>
|
||||
constexpr decltype(auto) asVariant(const std::variant<VTypes...> &v) noexcept { return v; }
|
||||
constexpr decltype(auto) asVariant(const std::variant<VTypes...>& v) noexcept { return v; }
|
||||
|
||||
template <class... VTypes>
|
||||
constexpr decltype(auto) asVariant(std::variant<VTypes...> &&v) noexcept { return std::move(v); }
|
||||
constexpr decltype(auto) asVariant(std::variant<VTypes...>&& v) noexcept { return std::move(v); }
|
||||
|
||||
template <class... VTypes>
|
||||
constexpr decltype(auto) asVariant(const std::variant<VTypes...> &&v) noexcept { return std::move(v); }
|
||||
constexpr decltype(auto) asVariant(const std::variant<VTypes...>&& v) noexcept { return std::move(v); }
|
||||
|
||||
// visit a std::variant or object derived from std::variant
|
||||
constexpr decltype(auto) visit(auto &&func, auto &v)
|
||||
template <class Func>
|
||||
constexpr decltype(auto) visit(Func&& func, auto& v)
|
||||
{
|
||||
return visitVariant(std::forward<decltype(func)>(func),
|
||||
asVariant(std::forward<decltype(v)>(v)));
|
||||
return visitVariant(std::forward<Func>(func), asVariant(v));
|
||||
}
|
||||
|
||||
class AddVisit
|
||||
{
|
||||
public:
|
||||
template <class Func>
|
||||
constexpr decltype(auto) visit(this auto&& self, Func&& func)
|
||||
{
|
||||
return IG::visit(std::forward<Func>(func), asVariant(self));
|
||||
}
|
||||
|
||||
bool operator==(AddVisit const&) const = default;
|
||||
};
|
||||
|
||||
template<class T, class... VTypes>
|
||||
constexpr T& getAs(std::variant<VTypes...> &v)
|
||||
constexpr T& getAs(std::variant<VTypes...>& v)
|
||||
{
|
||||
auto vPtr = std::get_if<T>(&v);
|
||||
assumeExpr(vPtr);
|
||||
@ -87,7 +99,7 @@ constexpr T& getAs(std::variant<VTypes...> &v)
|
||||
}
|
||||
|
||||
template<class T, class... VTypes>
|
||||
constexpr const T& getAs(const std::variant<VTypes...> &v)
|
||||
constexpr const T& getAs(const std::variant<VTypes...>& v)
|
||||
{
|
||||
auto vPtr = std::get_if<T>(&v);
|
||||
assumeExpr(vPtr);
|
||||
|
@ -8,7 +8,7 @@ CFLAGS_OPTIMIZE_LEVEL_RELEASE_DEFAULT ?= -Ofast
|
||||
CFLAGS_OPTIMIZE_RELEASE_DEFAULT ?= $(CFLAGS_OPTIMIZE_LEVEL_RELEASE_DEFAULT) $(CFLAGS_OPTIMIZE_MISC_RELEASE_DEFAULT)
|
||||
CFLAGS_CODEGEN += -pipe -fvisibility=hidden -ffunction-sections -fdata-sections
|
||||
CFLAGS_LANG = -fno-common
|
||||
CXXFLAGS_LANG = -std=gnu++2b $(if $(cxxThreadSafeStatics),,-fno-threadsafe-statics) -fvisibility-inlines-hidden
|
||||
CXXFLAGS_LANG = -std=gnu++26 $(if $(cxxThreadSafeStatics),,-fno-threadsafe-statics) -fvisibility-inlines-hidden
|
||||
|
||||
ifeq ($(ENV), ios)
|
||||
ifeq ($(SUBARCH), armv7)
|
||||
@ -19,7 +19,6 @@ endif
|
||||
# setup warnings
|
||||
|
||||
CFLAGS_WARN ?= -Wall -Wextra -Werror=return-type -Wno-comment -Wno-unused -Wno-unused-parameter
|
||||
CFLAGS_WARN += $(CFLAGS_WARN_EXTRA)
|
||||
CXXFLAGS_WARN ?= $(CFLAGS_WARN) -Woverloaded-virtual
|
||||
|
||||
# setup optimizations
|
||||
|
@ -1,4 +1,4 @@
|
||||
LD := $(CXX)
|
||||
LD = $(CXX)
|
||||
|
||||
ifdef LINK_MAP
|
||||
MAPFILE := link.map
|
||||
|
@ -1,15 +1,6 @@
|
||||
ifndef inc_pkg_freetype
|
||||
inc_pkg_freetype := 1
|
||||
|
||||
ifeq ($(ENV), webos)
|
||||
CPPFLAGS += -I$(WEBOS_PDK_PATH)/include/freetype2
|
||||
LDLIBS += -lfreetype
|
||||
else ifeq ($(ENV), macosx)
|
||||
# MacPorts version
|
||||
CPPFLAGS += -I/opt/local/include/freetype2
|
||||
LDLIBS += /opt/local/lib/libfreetype.a -lz
|
||||
else
|
||||
pkgConfigDeps += freetype2
|
||||
endif
|
||||
pkgConfigDeps += freetype2
|
||||
|
||||
endif
|
@ -46,13 +46,13 @@ void OutputStream::setApi(const Manager &mgr, Api api)
|
||||
}
|
||||
}
|
||||
|
||||
StreamError OutputStream::open(OutputStreamConfig config) { return visit([&](auto &v){ return v.open(config); }, *this); }
|
||||
void OutputStream::play() { visit([&](auto &v){ v.play(); }, *this); }
|
||||
void OutputStream::pause() { visit([&](auto &v){ v.pause(); }, *this); }
|
||||
void OutputStream::close() { visit([&](auto &v){ v.close(); }, *this); }
|
||||
void OutputStream::flush() { visit([&](auto &v){ v.flush(); }, *this); }
|
||||
bool OutputStream::isOpen() { return visit([&](auto &v){ return v.isOpen(); }, *this); }
|
||||
bool OutputStream::isPlaying() { return visit([&](auto &v){ return v.isPlaying(); }, *this); }
|
||||
StreamError OutputStream::open(OutputStreamConfig config) { return visit([&](auto &v){ return v.open(config); }); }
|
||||
void OutputStream::play() { visit([&](auto &v){ v.play(); }); }
|
||||
void OutputStream::pause() { visit([&](auto &v){ v.pause(); }); }
|
||||
void OutputStream::close() { visit([&](auto &v){ v.close(); }); }
|
||||
void OutputStream::flush() { visit([&](auto &v){ v.flush(); }); }
|
||||
bool OutputStream::isOpen() { return visit([&](auto &v){ return v.isOpen(); }); }
|
||||
bool OutputStream::isPlaying() { return visit([&](auto &v){ return v.isPlaying(); }); }
|
||||
void OutputStream::reset() { emplace<NullOutputStream>(); }
|
||||
|
||||
OutputStreamConfig Manager::makeNativeOutputStreamConfig() const
|
||||
|
@ -229,13 +229,13 @@ void Window::drawNow(bool needsSync)
|
||||
bool Window::dispatchInputEvent(Input::Event event)
|
||||
{
|
||||
bool handled = onEvent.callCopy(*this, event);
|
||||
return visit(overloaded{
|
||||
return event.visit(overloaded{
|
||||
[&](const Input::MotionEvent &e)
|
||||
{
|
||||
return handled || (e.isPointer() && contentBounds().overlaps(e.pos()));
|
||||
},
|
||||
[&](const Input::KeyEvent &e) { return handled; }
|
||||
}, event);
|
||||
});
|
||||
}
|
||||
|
||||
bool Window::dispatchRepeatableKeyInputEvent(Input::KeyEvent event)
|
||||
|
@ -315,7 +315,7 @@ void Device::setICadeMode(bool on)
|
||||
{
|
||||
if constexpr(requires {d.setICadeMode(on);})
|
||||
d.setICadeMode(on);
|
||||
}, *this);
|
||||
});
|
||||
}
|
||||
|
||||
bool Device::iCadeMode() const
|
||||
@ -326,7 +326,7 @@ bool Device::iCadeMode() const
|
||||
return d.iCadeMode();
|
||||
else
|
||||
return false;
|
||||
}, *this);
|
||||
});
|
||||
}
|
||||
|
||||
void Device::setJoystickAxesAsKeys(AxisSetId id, bool on)
|
||||
@ -361,7 +361,7 @@ const char *Device::keyName(Key k) const
|
||||
return d.keyName(k);
|
||||
else
|
||||
return nullptr;
|
||||
}, *this);
|
||||
});
|
||||
if(customName)
|
||||
return customName;
|
||||
switch(map())
|
||||
@ -420,7 +420,7 @@ std::string Device::keyString(Key k, KeyNameFlags flags) const
|
||||
|
||||
Map Device::map() const
|
||||
{
|
||||
return visit([](auto &d){ return d.map_; }, *this);
|
||||
return visit([](auto &d){ return d.map_; });
|
||||
}
|
||||
|
||||
static DeviceSubtype gamepadSubtype(std::string_view name)
|
||||
|
@ -356,8 +356,8 @@ bool KeyEvent::hasSwappedConfirmKeys() const
|
||||
return keyFlags; // currently there is only a single flag
|
||||
}
|
||||
|
||||
SteadyClockTimePoint Event::time() const { return visit([](auto &e){ return e.time(); }, *this); }
|
||||
SteadyClockTimePoint Event::time() const { return visit([](auto &e){ return e.time(); }); }
|
||||
|
||||
const Device *Event::device() const { return visit([](auto &e){ return e.device(); }, *this); }
|
||||
const Device *Event::device() const { return visit([](auto &e){ return e.device(); }); }
|
||||
|
||||
}
|
||||
|
@ -27,18 +27,18 @@ template class IOUtils<IO>;
|
||||
|
||||
ssize_t IO::read(void *buff, size_t bytes, std::optional<off_t> offset)
|
||||
{
|
||||
return visit([&](auto &io){ return io.read(buff, bytes, offset); }, *this);
|
||||
return visit([&](auto &io){ return io.read(buff, bytes, offset); });
|
||||
}
|
||||
|
||||
ssize_t IO::write(const void *buff, size_t bytes, std::optional<off_t> offset)
|
||||
{
|
||||
return visit([&](auto &io){ return io.write(buff, bytes, offset); }, *this);
|
||||
return visit([&](auto &io){ return io.write(buff, bytes, offset); });
|
||||
}
|
||||
|
||||
off_t IO::seek(off_t offset, IOSeekMode mode) { return visit([&](auto &io){ return io.seek(offset, mode); }, *this); }
|
||||
size_t IO::size() { return visit([&](auto &io){ return io.size(); }, *this); }
|
||||
bool IO::eof() { return visit([&](auto &io){ return io.eof(); }, *this); }
|
||||
IO::operator bool() const { return visit([&](auto &io){ return (bool)io; }, *this); }
|
||||
off_t IO::seek(off_t offset, IOSeekMode mode) { return visit([&](auto &io){ return io.seek(offset, mode); }); }
|
||||
size_t IO::size() { return visit([&](auto &io){ return io.size(); }); }
|
||||
bool IO::eof() { return visit([&](auto &io){ return io.eof(); }); }
|
||||
IO::operator bool() const { return visit([&](auto &io){ return (bool)io; }); }
|
||||
|
||||
std::span<uint8_t> IO::map()
|
||||
{
|
||||
@ -48,7 +48,7 @@ std::span<uint8_t> IO::map()
|
||||
return io.map();
|
||||
else
|
||||
return std::span<uint8_t>{};
|
||||
}, *this);
|
||||
});
|
||||
};
|
||||
|
||||
ssize_t IO::writeVector(std::span<const OutVector> buffs, std::optional<off_t> offset)
|
||||
@ -59,7 +59,7 @@ ssize_t IO::writeVector(std::span<const OutVector> buffs, std::optional<off_t> o
|
||||
return io.writeVector(buffs, offset);
|
||||
else
|
||||
return io.genericWriteVector(buffs, offset);
|
||||
}, *this);
|
||||
});
|
||||
}
|
||||
|
||||
bool IO::truncate(off_t offset)
|
||||
@ -70,7 +70,7 @@ bool IO::truncate(off_t offset)
|
||||
return io.truncate(offset);
|
||||
else
|
||||
return false;
|
||||
}, *this);
|
||||
});
|
||||
};
|
||||
|
||||
void IO::sync()
|
||||
@ -79,7 +79,7 @@ void IO::sync()
|
||||
{
|
||||
if constexpr(requires {io.sync();})
|
||||
io.sync();
|
||||
}, *this);
|
||||
});
|
||||
}
|
||||
|
||||
void IO::advise(off_t offset, size_t bytes, Advice advice)
|
||||
@ -88,7 +88,7 @@ void IO::advise(off_t offset, size_t bytes, Advice advice)
|
||||
{
|
||||
if constexpr(requires {io.advise(offset, bytes, advice);})
|
||||
return io.advise(offset, bytes, advice);
|
||||
}, *this);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -233,7 +233,7 @@ void FrameRateTestApplication::setActiveTestHandlers(IG::Window &win)
|
||||
[&](Input::Event &e)
|
||||
{
|
||||
auto &activeTest = windowData(win).activeTest;
|
||||
return visit(overloaded
|
||||
return e.visit(overloaded
|
||||
{
|
||||
[&](const Input::MotionEvent &motionEv)
|
||||
{
|
||||
@ -261,7 +261,7 @@ void FrameRateTestApplication::setActiveTestHandlers(IG::Window &win)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}, e);
|
||||
});
|
||||
},
|
||||
[](auto &){ return false; }
|
||||
}, winEvent);
|
||||
|
Loading…
Reference in New Issue
Block a user