mirror of
https://github.com/libretro/bsnes-libretro.git
synced 2024-11-26 18:40:47 +00:00
4d7bb510f2
byuu says: Don't let the point release fool you, there are many significant changes in this release. I will be keeping bsnes releases using a point system until the new higan release is ready. Changelog: - GUI: added high DPI support - GUI: fixed the state manager image preview - Windows: added a new waveOut driver with support for dynamic rate control - Windows: corrected the XAudio 2.1 dynamic rate control support [BearOso] - Windows: corrected the Direct3D 9.0 fullscreen exclusive window centering - Windows: fixed XInput controller support on Windows 10 - SFC: added high-level emulation for the DSP1, DSP2, DSP4, ST010, and Cx4 coprocessors - SFC: fixed a slight rendering glitch in the intro to Megalomania If the coprocessor firmware is missing, bsnes will fallback on HLE where it is supported, which is everything other than SD Gundam GX and the two Hayazashi Nidan Morita Shougi games. The Windows dynamic rate control works best with Direct3D in fullscreen exclusive mode. I recommend the waveOut driver over the XAudio 2.1 driver, as it is not possible to target a single XAudio2 version on all Windows OS releases. The waveOut driver should work everywhere out of the box. Note that with DRC, the synchronization source is your monitor, so you will want to be running at 60hz (NTSC) or 50hz (PAL). If you have an adaptive sync monitor, you should instead use the WASAPI (exclusive) or ASIO audio driver.
107 lines
2.5 KiB
C++
107 lines
2.5 KiB
C++
#pragma once
|
|
|
|
namespace nall {
|
|
|
|
template<typename T>
|
|
struct unique_pointer {
|
|
template<typename... P> static auto create(P&&... p) {
|
|
return unique_pointer<T>{new T{forward<P>(p)...}};
|
|
}
|
|
|
|
using type = T;
|
|
T* pointer = nullptr;
|
|
function<void (T*)> deleter;
|
|
|
|
unique_pointer(const unique_pointer&) = delete;
|
|
auto operator=(const unique_pointer&) -> unique_pointer& = delete;
|
|
|
|
unique_pointer(T* pointer = nullptr, const function<void (T*)>& deleter = {}) : pointer(pointer), deleter(deleter) {}
|
|
~unique_pointer() { reset(); }
|
|
|
|
auto operator=(T* source) -> unique_pointer& {
|
|
reset();
|
|
pointer = source;
|
|
return *this;
|
|
}
|
|
|
|
explicit operator bool() const { return pointer; }
|
|
|
|
auto operator->() -> T* { return pointer; }
|
|
auto operator->() const -> const T* { return pointer; }
|
|
|
|
auto operator*() -> T& { return *pointer; }
|
|
auto operator*() const -> const T& { return *pointer; }
|
|
|
|
auto operator()() -> T& { return *pointer; }
|
|
auto operator()() const -> const T& { return *pointer; }
|
|
|
|
auto data() -> T* { return pointer; }
|
|
auto data() const -> const T* { return pointer; }
|
|
|
|
auto release() -> T* {
|
|
auto result = pointer;
|
|
pointer = nullptr;
|
|
return result;
|
|
}
|
|
|
|
auto reset() -> void {
|
|
if(pointer) {
|
|
if(deleter) {
|
|
deleter(pointer);
|
|
} else {
|
|
delete pointer;
|
|
}
|
|
pointer = nullptr;
|
|
}
|
|
}
|
|
};
|
|
|
|
template<typename T>
|
|
struct unique_pointer<T[]> {
|
|
using type = T;
|
|
T* pointer = nullptr;
|
|
function<auto (T*) -> void> deleter;
|
|
|
|
unique_pointer(const unique_pointer&) = delete;
|
|
auto operator=(const unique_pointer&) -> unique_pointer& = delete;
|
|
|
|
unique_pointer(T* pointer = nullptr, const function<void (T*)>& deleter = {}) : pointer(pointer), deleter(deleter) {}
|
|
~unique_pointer() { reset(); }
|
|
|
|
auto operator=(T* source) -> unique_pointer& {
|
|
reset();
|
|
pointer = source;
|
|
return *this;
|
|
}
|
|
|
|
explicit operator bool() const { return pointer; }
|
|
|
|
auto operator()() -> T* { return pointer; }
|
|
auto operator()() const -> T* { return pointer; }
|
|
|
|
alwaysinline auto operator[](uint offset) -> T& { return pointer[offset]; }
|
|
alwaysinline auto operator[](uint offset) const -> const T& { return pointer[offset]; }
|
|
|
|
auto data() -> T* { return pointer; }
|
|
auto data() const -> const T* { return pointer; }
|
|
|
|
auto release() -> T* {
|
|
auto result = pointer;
|
|
pointer = nullptr;
|
|
return result;
|
|
}
|
|
|
|
auto reset() -> void {
|
|
if(pointer) {
|
|
if(deleter) {
|
|
deleter(pointer);
|
|
} else {
|
|
delete[] pointer;
|
|
}
|
|
pointer = nullptr;
|
|
}
|
|
}
|
|
};
|
|
|
|
}
|