Compare commits

..

5 Commits

Author SHA1 Message Date
TakaRikka 1a7c853d9b better disc info display 2026-05-16 21:06:55 -07:00
TakaRikka 9a3428983b build fix / verif 2026-05-16 19:37:46 -07:00
TakaRikka 15a846478b Merge branch 'main' of ssh://github.com/TwilitRealm/dusklight into jpn 2026-05-16 19:18:06 -07:00
TakaRikka 00704ad838 mDoExt font region handling 2026-04-28 03:43:52 -07:00
TakaRikka f52c715364 convert d_name literals to hex + enable version 2026-04-28 02:53:36 -07:00
62 changed files with 397 additions and 767 deletions
+51 -181
View File
@@ -1,165 +1,51 @@
# Building Dusklight ### Building
#### Prerequisites
## Dependencies
The following dependencies are required:
* [CMake 3.25+](https://cmake.org) * [CMake 3.25+](https://cmake.org)
* Windows: Install `CMake Tools` in Visual Studio
* macOS: `brew install cmake`
* [Python 3+](https://python.org) * [Python 3+](https://python.org)
* Windows: [Microsoft Store](https://go.microsoft.com/fwlink?linkID=2082640)
### Windows * Verify it's added to `%PATH%` by typing `python` in `cmd`.
* macOS: `brew install python@3`
* Install [CMake 3.25+](https://cmake.org) by searching `CMake Tools` in Visual Studio * **[Windows]** [Visual Studio 2026 Community](https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx)
* Install Python 3 from the [Microsoft Store](https://go.microsoft.com/fwlink?linkID=2082640) and verify it's added to `%PATH%` by typing `python` in `cmd`. * Select `C++ Development` and verify the following packages are included:
* `Windows 11 SDK`
Recommended IDEs: * `CMake Tools`
* `C++ Clang Compiler`
* [Visual Studio 2026 Community](https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx). During installation: * `C++ Clang-cl`
* Select `C++ Development` and verify the following packages are included: * **[macOS]** [Xcode 16.4+](https://developer.apple.com/xcode/download/)
* `Windows 11 SDK` * **[Linux]** Actively tested on Ubuntu 24.04, Arch Linux & derivatives.
* `CMake Tools` * Ubuntu 24.04+ packages
* `C++ Clang Compiler` ```
* `C++ Clang-cl` build-essential curl git ninja-build clang lld zlib1g-dev libcurl4-openssl-dev \
libglu1-mesa-dev libdbus-1-dev libvulkan-dev libxi-dev libxrandr-dev libasound2-dev libpulse-dev \
### macOS libudev-dev libpng-dev libncurses5-dev cmake libx11-xcb-dev python3 python-is-python3 \
libclang-dev libfreetype-dev libxinerama-dev libxcursor-dev python3-markupsafe libgtk-3-dev \
* Make sure [Homebrew](https://brew.sh) is installed libxss-dev libxtst-dev
* Install [CMake 3.25+](https://cmake.org) ```
* Arch Linux packages
```sh ```
brew install cmake base-devel cmake ninja llvm vulkan-headers python python-markupsafe clang lld alsa-lib libpulse libxrandr freetype2
``` ```
* Fedora packages
* Install Python 3 ```
cmake vulkan-headers ninja-build clang-devel llvm-devel libpng-devel
```sh ```
brew install python@3 * It's also important that you install the developer tools and libraries
``` ```
sudo dnf groupinstall "Development Tools" "Development Libraries"
Recommended IDEs: ```
#### Setup
* [Xcode 16.4 or later](https://developer.apple.com/xcode/) Clone and initialize the Dusklight repository
* [Visual Studio Code](https://code.visualstudio.com/download/)
* [CLion](https://www.jetbrains.com/clion/)
### Linux
Actively tested on Ubuntu 24.04, Arch Linux & derivatives.
**Ubuntu 24.04+ packages**
<details>
<summary>Click to expand</summary>
* Run the following command to install the required dependencies:
```sh
sudo apt update && sudo apt install -y \
build-essential \
clang \
cmake \
curl \
git \
libasound2-dev \
libclang-dev \
libcurl4-openssl-dev \
libdbus-1-dev \
libfreetype-dev \
libglu1-mesa-dev \
libgtk-3-dev \
libncurses5-dev \
libpng-dev \
libpulse-dev \
libudev-dev \
libvulkan-dev \
libx11-xcb-dev \
libxcursor-dev \
libxi-dev \
libxinerama-dev \
libxrandr-dev \
libxss-dev \
libxtst-dev \
lld \
ninja-build \
python-is-python3 \
python3 \
python3-markupsafe \
zlib1g-dev
```
</details>
<br>
**Arch Linux packages**
<details>
<summary>Click to expand</summary>
* Run the following command to install the required dependencies:
```sh
sudo pacman -S --needed \
alsa-lib \
base-devel \
clang \
cmake \
freetype2 \
libpulse \
libxrandr \
lld \
llvm \
ninja \
python \
python-markupsafe \
vulkan-headers
```
</details>
<br>
**Fedora packages**
<details>
<summary>Click to expand</summary>
* Run the following command to install the required dependencies:
```sh
sudo dnf install -y \
clang-devel \
cmake \
libpng-devel \
llvm-devel \
ninja-build \
vulkan-headers
```
* It's also important that you install the developer tools and libraries
```sh
sudo dnf groupinstall \
"Development Libraries" "Development Tools"
```
</details>
<br>
Recommended IDEs:
* [CLion](https://www.jetbrains.com/clion/)
* [Visual Studio Code](https://code.visualstudio.com/download/)
## Building
* Clone and initialize the Dusklight repository:
```sh ```sh
git clone --recursive https://github.com/TwilitRealm/dusklight.git git clone --recursive https://github.com/TwilitRealm/dusklight.git
git pull
cd dusklight cd dusklight
git pull
git submodule update --init --recursive git submodule update --init --recursive
``` ```
#### Building
**CLion (Windows / macOS / Linux)** **CLion (Windows / macOS / Linux)**
Open the project directory in CLion. Enable the appropriate presets for your platform: Open the project directory in CLion. Enable the appropriate presets for your platform:
@@ -178,8 +64,7 @@ cmake --build --preset macos-default-relwithdebinfo
``` ```
Alternate presets available: Alternate presets available:
- `macos-default-debug`: Clang, Debug
* `macos-default-debug`: Clang, Debug
**ninja (Linux)** **ninja (Linux)**
@@ -189,10 +74,9 @@ cmake --build --preset linux-default-relwithdebinfo
``` ```
Alternate presets available: Alternate presets available:
- `linux-default-debug`: GCC, Debug
* `linux-default-debug`: GCC, Debug - `linux-clang-relwithdebinfo`: Clang, RelWithDebInfo
* `linux-clang-relwithdebinfo`: Clang, RelWithDebInfo - `linux-clang-debug`: Clang, Debug
* `linux-clang-debug`: Clang, Debug
**ninja (Windows)** **ninja (Windows)**
@@ -202,27 +86,13 @@ cmake --build --preset windows-msvc-relwithdebinfo
``` ```
Alternate presets available: Alternate presets available:
- `windows-msvc-debug`: MSVC, Debug
- `windows-clang-relwithdebinfo`: Clang-cl, RelWithDebInfo
- `windows-clang-debug`: Clang-cl, Debug
* `windows-msvc-debug`: MSVC, Debug #### Running
* `windows-clang-relwithdebinfo`: Clang-cl, RelWithDebInfo Pass the disc image as a positional argument. Supported formats: ISO (GCM), RVZ, WIA, WBFS, CISO, GCZ
* `windows-clang-debug`: Clang-cl, Debug
## Running
**Windows / Linux**
* Pass the disc image as a positional argument using the `--dvd` flag. Supported formats are: ISO (GCM), RVZ, WIA, WBFS, CISO, GCZ
```sh ```sh
build/{preset}/dusklight --dvd /path/to/game.iso build/{preset}/dusklight/path/to/game.rvz
```
**macOS**
macOS builds an `.app` bundle which contains the executable and all necessary resources.
* Pass the disc image as a positional argument using the `--dvd` flag. Supported formats are: ISO (GCM), RVZ, WIA, WBFS, CISO, GCZ
```sh
build/{preset}/Dusklight.app/Contents/MacOS/Dusklight --dvd /path/to/game.iso
``` ```
If no path is specified, Dusklight defaults to `game.iso` in the current working directory.
+10 -10
View File
@@ -4,10 +4,10 @@
- A Windows, Linux, or macOS device - A Windows, Linux, or macOS device
- iOS device connected to computer via USB - iOS device connected to computer via USB
- Dusklight IPA file (download the latest `Dusklight-vX.X.X-ios-arm64.ipa` from the [releases page](https://github.com/TwilitRealm/dusklight/releases)) - Dusklight IPA file (download the latest `Dusklight-vX.X.X-ios-arm64.ipa` from the [releases page](https://github.com/TwilitRealm/dusk/releases))
- Legally acquired game disc - `GZ2E01` (Gamecube USA) or `GZ2PE01` (Gamecube PAL) - Game disc - `GZ2E01` (Gamecube USA) or `GZ2PE01` (Gamecube PAL)
## 1. Install iloader ## 1. Install AltServer
- Executable bundles can be installed from [iloader's main page](https://iloader.app/) or [their GitHub](https://github.com/nab138/iloader) for Windows, Linux, and macOS. - Executable bundles can be installed from [iloader's main page](https://iloader.app/) or [their GitHub](https://github.com/nab138/iloader) for Windows, Linux, and macOS.
- Windows WILL require iTunes to be installed - Windows WILL require iTunes to be installed
@@ -16,21 +16,21 @@
## 2. Enable Developer Mode (iOS 16+) ## 2. Enable Developer Mode (iOS 16+)
- On your iPhone, go to **Settings > Privacy & Security > Developer Mode** - On your iPhone, go to **Settings > Privacy & Security > Developer Mode**
- Toggle it on, put in your device passcode, and restart when prompted - Toggle it on and restart when prompted
## 3. Install Dusklight on Your iPhone ## 3. Install Dusklight on Your iPhone
1. Sign into your Apple ID (this is required for registering app IDs, it is sent securely directly to Apple and not stored by iloader) 1. Sign into your Apple ID (this is required for registering app IDs, it is sent securely and not stored by iloader)
* You may be prompted to put in a code from your iOS device if you have 2FA enabled, do so * You may be prompted to put in a code from your iOS device, do so
2. Plug in your iOS device via USB into your PC. If you're missing a dependency, an error pop-up will tell you to install it 2. Plug in your iOS device via USB into your PC. If you're missing a dependency, an error pop-up will tell you to install it
* You will need to hit `Refresh` after plugging it in at this stage so that it can be detected, it does not automatically refresh * You will need to hit `Refresh` after plugging it in at this stage so that it can be detected, it does not automatically refresh
3. Leave settings unchanged (the Anisette server should stay Sidestore (.io)) 3. Leave settings unchanged (the Anisette server should stay Sidestore (.io))
3.(a) Installing SideStore directly is not required, but provides you a way to install Dusklight on your phone without being plugged into a computer later 3.(a) Installing SideStore directly is not required, but provides you a way to install Dusklight on your phone without being plugged into a computer later
4. Press `Import IPA` and choose your downloaded `Dusklight-v.X.X.X-ios-arm64.ipa`, it will begin installing on your device 4. Press `Import IPA` and choose your downloaded `Dusk-v.X.X.X-ios-arm64.ipa`, it will begin installing on your device
**NOTE:** *At various stages, you may be prompted to trust your device, do so* **NOTE:** *At various stages, you may be prompted to trust your device, do so*
## 3. Getting Dusklight trusted ## 3. Getting Dusk trusted
When installing sideloaded iOS applications, at first you will need to manually trust the app due to Apple's security policies When installing sideloaded iOS applications, at first you will need to manually trust the app due to Apple's security policies
* Go to **Settings > General > VPN & Device Management** * Go to **Settings > General > VPN & Device Management**
* Tap the Apple ID you signed into iloader with under "Developer App" and tap **Trust** * Tap the Apple ID you signed into iloader with under "Developer App" and tap **Trust**
@@ -38,11 +38,11 @@ When installing sideloaded iOS applications, at first you will need to manually
## 4. Copy Files to Your iPhone ## 4. Copy Files to Your iPhone
Transfer the game disc (and optionally, the Dusklight IPA) to your iPhone so they are accessible in the Files app. A few ways to do this: Transfer the IPA and game disc to your iPhone so they're accessible in the Files app. A few ways to do this:
- **AirDrop** - Right-click the files on your Mac and choose Share > AirDrop - **AirDrop** - Right-click the files on your Mac and choose Share > AirDrop
- **iCloud Drive** - Place files in iCloud Drive on your Mac and they'll sync to Files on your iPhone - **iCloud Drive** - Place files in iCloud Drive on your Mac and they'll sync to Files on your iPhone
- **USB transfer** - Connect your iPhone and drag files via Finder's sidebar - **USB transfer** - Connect your iPhone and drag files via Finder's sidebar
- **Cloud storage** - Upload to Google Drive, Dropbox, etc. and download on your iPhone - **Cloud storage** - Upload to Google Drive, Dropbox, etc. and download on your iPhone
You may now use Dusklight on iOS and iPadOS! You may now use Dusklight on iOS, iPadOS!
+1 -1
+10 -1
View File
@@ -15,6 +15,12 @@
# Dependencies that are not packaged in nixpkgs (used by the Linux package build): # Dependencies that are not packaged in nixpkgs (used by the Linux package build):
buildSources = pkgs: { buildSources = pkgs: {
aurora-src = pkgs.fetchFromGitHub {
owner = "encounter";
repo = "aurora";
rev = "63606a43265a3bc18dafd500ab4d7a2108f109e6";
hash = "sha256-xBvnAwGwNzav67Ac6oUz7RqDUwqgL2bsME3OOMn8Tqw=";
};
dawn-src = pkgs.fetchzip { dawn-src = pkgs.fetchzip {
url = "https://github.com/encounter/dawn-build/releases/download/v20260423.175430/dawn-linux-x86_64.tar.gz"; url = "https://github.com/encounter/dawn-build/releases/download/v20260423.175430/dawn-linux-x86_64.tar.gz";
hash = "sha256-HXfKTLHtMPwupnFnaflCARtXVPuS/0PoCePXidjE5xs="; hash = "sha256-HXfKTLHtMPwupnFnaflCARtXVPuS/0PoCePXidjE5xs=";
@@ -53,6 +59,9 @@
name = "dusklight"; name = "dusklight";
src = ./.; src = ./.;
postUnpack = '' postUnpack = ''
mkdir -p $sourceRoot/extern/aurora
cp -r ${srcs.aurora-src}/. $sourceRoot/extern/aurora/
chmod -R u+w $sourceRoot/extern/aurora
sed -i '/add_subdirectory(tests)/d' $sourceRoot/extern/aurora/CMakeLists.txt sed -i '/add_subdirectory(tests)/d' $sourceRoot/extern/aurora/CMakeLists.txt
''; '';
# Remove last line to re-enable tests # Remove last line to re-enable tests
@@ -216,4 +225,4 @@
default = mkDevShell (pkgsFor system); default = mkDevShell (pkgsFor system);
}); });
}; };
} }
-22
View File
@@ -227,28 +227,6 @@ struct BE<Mtx> {
} }
}; };
typedef f32 Mtx23[2][3];
template <>
struct BE<Mtx23> {
BE<f32> contents[2][3];
auto& operator[](int x) {
return contents[x];
}
auto& operator[](int x) const {
return contents[x];
}
void to_host(Mtx23& mtx) const {
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 3; j++) {
mtx[i][j] = contents[i][j];
}
}
}
};
template<typename T> template<typename T>
void be_swap(T& val) { void be_swap(T& val) {
val = BE<T>::swap(val); val = BE<T>::swap(val);
+1 -2
View File
@@ -4,7 +4,6 @@
#include <stdbool.h> #include <stdbool.h>
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include "settings.h"
class camera_process_class; class camera_process_class;
class view_class; class view_class;
@@ -19,7 +18,7 @@ void begin_record();
void end_record(); void end_record();
void begin_sim_tick(); void begin_sim_tick();
uint64_t sim_tick_seq(); uint64_t sim_tick_seq();
void begin_frame(FrameInterpMode mode, bool is_sim_frame, float step); void begin_frame(bool enabled, bool is_sim_frame, float step);
void interpolate(); void interpolate();
float get_interpolation_step(); float get_interpolation_step();
+2 -28
View File
@@ -15,11 +15,6 @@ enum class BloomMode : int {
Dusk = 2, Dusk = 2,
}; };
enum class Resampler : int {
Bilinear = 0,
Area = 1,
};
enum class GameLanguage : u8 { enum class GameLanguage : u8 {
English = OS_LANGUAGE_ENGLISH, English = OS_LANGUAGE_ENGLISH,
German = OS_LANGUAGE_GERMAN, German = OS_LANGUAGE_GERMAN,
@@ -39,12 +34,6 @@ enum class GyroMode : u8 {
Mouse = 1, Mouse = 1,
}; };
enum class FrameInterpMode : u8 {
Off = 0,
Capped = 1,
Unlimited = 2,
};
namespace config { namespace config {
template <> template <>
struct ConfigEnumRange<BloomMode> { struct ConfigEnumRange<BloomMode> {
@@ -52,12 +41,6 @@ struct ConfigEnumRange<BloomMode> {
static constexpr auto max = BloomMode::Dusk; static constexpr auto max = BloomMode::Dusk;
}; };
template <>
struct ConfigEnumRange<Resampler> {
static constexpr auto min = Resampler::Bilinear;
static constexpr auto max = Resampler::Area;
};
template <> template <>
struct ConfigEnumRange<GameLanguage> { struct ConfigEnumRange<GameLanguage> {
static constexpr auto min = GameLanguage::English; static constexpr auto min = GameLanguage::English;
@@ -75,13 +58,7 @@ struct ConfigEnumRange<GyroMode> {
static constexpr auto min = GyroMode::Sensor; static constexpr auto min = GyroMode::Sensor;
static constexpr auto max = GyroMode::Mouse; static constexpr auto max = GyroMode::Mouse;
}; };
}
template <>
struct ConfigEnumRange<FrameInterpMode> {
static constexpr auto min = FrameInterpMode::Off;
static constexpr auto max = FrameInterpMode::Unlimited;
};
} // namespace config
// Persistent user settings // Persistent user settings
@@ -95,7 +72,6 @@ struct UserSettings {
ConfigVar<bool> lockAspectRatio; ConfigVar<bool> lockAspectRatio;
ConfigVar<bool> enableFpsOverlay; ConfigVar<bool> enableFpsOverlay;
ConfigVar<int> fpsOverlayCorner; ConfigVar<int> fpsOverlayCorner;
ConfigVar<int> maxFrameRate;
} video; } video;
struct { struct {
@@ -147,11 +123,9 @@ struct UserSettings {
ConfigVar<BloomMode> bloomMode; ConfigVar<BloomMode> bloomMode;
ConfigVar<float> bloomMultiplier; ConfigVar<float> bloomMultiplier;
ConfigVar<bool> disableWaterRefraction; ConfigVar<bool> disableWaterRefraction;
ConfigVar<bool> enableTextureReplacements; ConfigVar<bool> enableFrameInterpolation;
ConfigVar<FrameInterpMode> enableFrameInterpolation;
ConfigVar<int> internalResolutionScale; ConfigVar<int> internalResolutionScale;
ConfigVar<int> shadowResolutionMultiplier; ConfigVar<int> shadowResolutionMultiplier;
ConfigVar<Resampler> resampler;
ConfigVar<bool> enableDepthOfField; ConfigVar<bool> enableDepthOfField;
ConfigVar<bool> enableMapBackground; ConfigVar<bool> enableMapBackground;
ConfigVar<bool> disableCutscenePillarboxing; ConfigVar<bool> disableCutscenePillarboxing;
+4 -40
View File
@@ -17,24 +17,16 @@
#include <shellapi.h> #include <shellapi.h>
#include <intrin.h> #include <intrin.h>
#endif #endif
#ifdef __APPLE__
#include <mach/mach_time.h>
#if defined(__x86_64__) || defined(__i386__)
#include <immintrin.h>
#endif
#endif
class Limiter { class Limiter {
public: public:
using duration_t = Uint64; using duration_t = Uint64;
void Reset() { void Reset() { m_oldTime = SDL_GetTicksNS(); }
m_oldTime = SDL_GetTicksNS();
}
duration_t Sleep(duration_t targetFrameTime) { void Sleep(duration_t targetFrameTime) {
if (targetFrameTime == 0) { if (targetFrameTime == 0) {
return 0; return;
} }
const Uint64 start = SDL_GetTicksNS(); const Uint64 start = SDL_GetTicksNS();
@@ -49,8 +41,6 @@ public:
} }
} }
Reset(); Reset();
return adjustedSleepTime;
} }
duration_t SleepTime(duration_t targetFrameTime) { duration_t SleepTime(duration_t targetFrameTime) {
@@ -84,6 +74,7 @@ private:
if (!initialized || numSleeps++ % 1000 == 0) { if (!initialized || numSleeps++ % 1000 == 0) {
LARGE_INTEGER freq; LARGE_INTEGER freq;
if (QueryPerformanceFrequency(&freq) == 0) { if (QueryPerformanceFrequency(&freq) == 0) {
DuskLog.warn("QueryPerformanceFrequency failed: {}", GetLastError());
return; return;
} }
countPerNs = static_cast<double>(freq.QuadPart) / 1e9; countPerNs = static_cast<double>(freq.QuadPart) / 1e9;
@@ -107,33 +98,6 @@ private:
#endif #endif
} while (current.QuadPart - start.QuadPart < ticksToWait); } while (current.QuadPart - start.QuadPart < ticksToWait);
} }
#elif defined (__APPLE__)
void NanoSleep(const duration_t duration) {
// Hybrid approach using Apple Mach
uint64_t start_mach = mach_absolute_time();
mach_timebase_info_data_t timebase_info;
mach_timebase_info(&timebase_info);
uint64_t total_mach_ticks = (duration * timebase_info.denom) / timebase_info.numer;
uint64_t target_mach = start_mach + total_mach_ticks;
uint64_t buffer_ns = 2'000'000ULL;
uint64_t buffer_mach_ticks = (buffer_ns * timebase_info.denom) / timebase_info.numer;
if (total_mach_ticks > buffer_mach_ticks) {
uint64_t sleep_until_mach = target_mach - buffer_mach_ticks;
mach_wait_until(sleep_until_mach);
}
while (mach_absolute_time() < target_mach) {
#if defined(__aarch64__) || defined(__arm__)
asm volatile("yield" ::: "memory"); // Hardware hint, not a scheduler hint.
#else
_mm_pause();
#endif
}
}
#else #else
void NanoSleep(const duration_t duration) { SDL_DelayPrecise(duration); } void NanoSleep(const duration_t duration) { SDL_DelayPrecise(duration); }
#endif #endif
@@ -116,7 +116,7 @@ private:
* *
*/ */
struct J2DIndTexMtxInfo { struct J2DIndTexMtxInfo {
/* 0x00 */ BE(Mtx23) mMtx; /* 0x00 */ Mtx23 mMtx;
/* 0x18 */ s8 mScaleExp; /* 0x18 */ s8 mScaleExp;
J2DIndTexMtxInfo& operator=(const J2DIndTexMtxInfo& other) { J2DIndTexMtxInfo& operator=(const J2DIndTexMtxInfo& other) {
@@ -287,28 +287,28 @@ template <typename T>
class JASPoolAllocObject { class JASPoolAllocObject {
public: public:
#if TARGET_PC #if TARGET_PC
static void* operator new(size_t n, JKRHeapToken) IF_DUSK(noexcept) { static void* operator new(size_t n, JKRHeapToken) {
return operator new(n); return operator new(n);
} }
#endif #endif
static void* operator new(size_t n) IF_DUSK(noexcept) { static void* operator new(size_t n) {
#if PLATFORM_GCN #if PLATFORM_GCN
JASMemPool<T>& memPool_ = getMemPool_(); JASMemPool<T>& memPool_ = getMemPool_();
#endif #endif
return memPool_.alloc(n); return memPool_.alloc(n);
} }
static void* operator new(size_t n, void* ptr) IF_DUSK(noexcept) { static void* operator new(size_t n, void* ptr) {
return ptr; return ptr;
} }
#if TARGET_PC #if TARGET_PC
static void operator delete(void* ptr, size_t n, JKRHeapToken) IF_DUSK(noexcept) { static void operator delete(void* ptr, size_t n, JKRHeapToken) {
operator delete(ptr, n); operator delete(ptr, n);
} }
#endif #endif
static void operator delete(void* ptr, size_t n) IF_DUSK(noexcept) { static void operator delete(void* ptr, size_t n) {
#if PLATFORM_GCN #if PLATFORM_GCN
JASMemPool<T>& memPool_ = getMemPool_(); JASMemPool<T>& memPool_ = getMemPool_();
#endif #endif
@@ -402,28 +402,28 @@ template <typename T>
class JASPoolAllocObject_MultiThreaded { class JASPoolAllocObject_MultiThreaded {
public: public:
#if TARGET_PC #if TARGET_PC
static void* operator new(size_t n, JKRHeapToken) IF_DUSK(noexcept) { static void* operator new(size_t n, JKRHeapToken) {
return operator new(n); return operator new(n);
} }
#endif #endif
static void* operator new(size_t n) IF_DUSK(noexcept) { static void* operator new(size_t n) {
#if PLATFORM_GCN #if PLATFORM_GCN
JASMemPool_MultiThreaded<T>& memPool_ = getMemPool(); JASMemPool_MultiThreaded<T>& memPool_ = getMemPool();
#endif #endif
return memPool_.alloc(n); return memPool_.alloc(n);
} }
static void* operator new(size_t n, void* ptr) IF_DUSK(noexcept) { static void* operator new(size_t n, void* ptr) {
return ptr; return ptr;
} }
#if TARGET_PC #if TARGET_PC
static void operator delete(void* ptr, size_t n, JKRHeapToken) IF_DUSK(noexcept) { static void operator delete(void* ptr, size_t n, JKRHeapToken) {
return operator delete(ptr, n); return operator delete(ptr, n);
} }
#endif #endif
static void operator delete(void* ptr, size_t n) IF_DUSK(noexcept) { static void operator delete(void* ptr, size_t n) {
#if PLATFORM_GCN #if PLATFORM_GCN
JASMemPool_MultiThreaded<T>& memPool_ = getMemPool(); JASMemPool_MultiThreaded<T>& memPool_ = getMemPool();
#endif #endif
+15 -19
View File
@@ -237,11 +237,11 @@ enum class JKRHeapToken {
Dummy Dummy
}; };
inline void* operator new(size_t, JKRHeapToken, void* where) noexcept { inline void* operator new(size_t, JKRHeapToken, void* where) {
return where; return where;
} }
inline void* operator new[](size_t, JKRHeapToken, void* where) noexcept { inline void* operator new[](size_t, JKRHeapToken, void* where) {
return where; return where;
} }
@@ -264,21 +264,21 @@ inline void* operator new[](size_t, JKRHeapToken, void* where) noexcept {
#define JKR_HEAP_TOKEN_PARAM #define JKR_HEAP_TOKEN_PARAM
#endif #endif
void* operator new(size_t size JKR_HEAP_TOKEN_PARAM) IF_DUSK(noexcept); void* operator new(size_t size JKR_HEAP_TOKEN_PARAM);
void* operator new(size_t size JKR_HEAP_TOKEN_PARAM, int alignment) IF_DUSK(noexcept); void* operator new(size_t size JKR_HEAP_TOKEN_PARAM, int alignment);
void* operator new(size_t size JKR_HEAP_TOKEN_PARAM, JKRHeap* heap, int alignment) IF_DUSK(noexcept); void* operator new(size_t size JKR_HEAP_TOKEN_PARAM, JKRHeap* heap, int alignment);
// On PC, these new[] overloads are only used to catch usages of JKR_NEW with []. // On PC, these new[] overloads are only used to catch usages of JKR_NEW with [].
void* operator new[](size_t size JKR_HEAP_TOKEN_PARAM) IF_DUSK(noexcept); void* operator new[](size_t size JKR_HEAP_TOKEN_PARAM);
void* operator new[](size_t size JKR_HEAP_TOKEN_PARAM, int alignment) IF_DUSK(noexcept); void* operator new[](size_t size JKR_HEAP_TOKEN_PARAM, int alignment);
void* operator new[](size_t size JKR_HEAP_TOKEN_PARAM, JKRHeap* heap, int alignment) IF_DUSK(noexcept); void* operator new[](size_t size JKR_HEAP_TOKEN_PARAM, JKRHeap* heap, int alignment);
void operator delete(void* ptr JKR_HEAP_TOKEN_PARAM) IF_DUSK(noexcept); void operator delete(void* ptr JKR_HEAP_TOKEN_PARAM);
void operator delete[](void* ptr JKR_HEAP_TOKEN_PARAM) IF_DUSK(noexcept); void operator delete[](void* ptr JKR_HEAP_TOKEN_PARAM);
#if TARGET_PC #if TARGET_PC
template<typename T> template<typename T>
void jkrDelete(T* ptr) IF_DUSK(noexcept) { void jkrDelete(T* ptr) {
if (ptr == nullptr) { if (ptr == nullptr) {
return; return;
} }
@@ -298,7 +298,7 @@ void jkrDelete(T* ptr) IF_DUSK(noexcept) {
} }
template<> template<>
inline void jkrDelete(void* ptr) IF_DUSK(noexcept) { inline void jkrDelete(void* ptr) {
if (ptr == nullptr) { if (ptr == nullptr) {
return; return;
} }
@@ -322,7 +322,7 @@ constexpr bool newArgsHasCustomAlignment() {
} }
template<typename T, typename... Args> template<typename T, typename... Args>
T* jkrNewArray(size_t count, std::in_place_type_t<T>, Args&&... args) IF_DUSK(noexcept) { T* jkrNewArray(size_t count, std::in_place_type_t<T>, Args&&... args) {
size_t allocSize = count * sizeof(T); size_t allocSize = count * sizeof(T);
if constexpr (!std::is_trivially_destructible<T>()) { if constexpr (!std::is_trivially_destructible<T>()) {
static_assert( static_assert(
@@ -333,10 +333,6 @@ T* jkrNewArray(size_t count, std::in_place_type_t<T>, Args&&... args) IF_DUSK(no
} }
void* ptr = operator new(allocSize, JKRHeapToken::Dummy, args...); void* ptr = operator new(allocSize, JKRHeapToken::Dummy, args...);
if (!ptr) {
return nullptr;
}
T* dataPtr; T* dataPtr;
if constexpr (!std::is_trivially_destructible<T>()) { if constexpr (!std::is_trivially_destructible<T>()) {
auto length = static_cast<size_t*>(ptr); auto length = static_cast<size_t*>(ptr);
@@ -356,7 +352,7 @@ T* jkrNewArray(size_t count, std::in_place_type_t<T>, Args&&... args) IF_DUSK(no
} }
template<typename T> template<typename T>
void jkrDeleteArray(T* pointer) IF_DUSK(noexcept) { void jkrDeleteArray(T* pointer) {
if (pointer == nullptr) { if (pointer == nullptr) {
return; return;
} }
@@ -376,7 +372,7 @@ void jkrDeleteArray(T* pointer) IF_DUSK(noexcept) {
} }
template<> template<>
inline void jkrDeleteArray(void* pointer) IF_DUSK(noexcept) { inline void jkrDeleteArray(void* pointer) {
if (pointer == nullptr) { if (pointer == nullptr) {
return; return;
} }
-6
View File
@@ -68,14 +68,8 @@ void J2DIndTevStage::load(u8 tevStage) {
} }
void J2DIndTexMtx::load(u8 indTexMtx) { void J2DIndTexMtx::load(u8 indTexMtx) {
#ifdef TARGET_PC
Mtx23 mtx;
mIndTexMtxInfo.mMtx.to_host(mtx);
GXSetIndTexMtx((GXIndTexMtxID)(GX_ITM_0 + indTexMtx), mtx, mIndTexMtxInfo.mScaleExp);
#else
GXSetIndTexMtx((GXIndTexMtxID)(GX_ITM_0 + indTexMtx), mIndTexMtxInfo.mMtx, GXSetIndTexMtx((GXIndTexMtxID)(GX_ITM_0 + indTexMtx), mIndTexMtxInfo.mMtx,
mIndTexMtxInfo.mScaleExp); mIndTexMtxInfo.mScaleExp);
#endif
} }
void J2DIndTexCoordScale::load(u8 indTexStage) { void J2DIndTexCoordScale::load(u8 indTexStage) {
+7 -7
View File
@@ -370,28 +370,28 @@ constexpr auto FRAME_PERIOD = std::chrono::duration_cast<std::chrono::nanosecond
constexpr auto RETRACE_PERIOD = FRAME_PERIOD / 2; constexpr auto RETRACE_PERIOD = FRAME_PERIOD / 2;
static void waitPrecise(Limiter& limiter, Limiter::duration_t targetNs) { static void waitPrecise(Limiter& limiter, Limiter::duration_t targetNs) {
const auto sleepTime = limiter.Sleep(targetNs); const auto sleepTime = limiter.SleepTime(targetNs);
dusk::frameUsagePct = dusk::frameUsagePct =
100.0f * (1.0f - static_cast<float>(sleepTime) / static_cast<float>(targetNs)); 100.0f * (1.0f - static_cast<float>(sleepTime) / static_cast<float>(targetNs));
limiter.Sleep(targetNs);
} }
#endif #endif
static void waitForTick(u32 p1, u16 p2) { static void waitForTick(u32 p1, u16 p2) {
#if TARGET_PC #if TARGET_PC
static Limiter limiter; if (dusk::getSettings().game.enableFrameInterpolation && !dusk::getTransientSettings().skipFrameRateLimit) {
dusk::frameUsagePct = 0.f;
if (dusk::frame_interp::is_enabled() && !dusk::getTransientSettings().skipFrameRateLimit) { return;
dusk::frameUsagePct = 0.f;
return;
} }
if (dusk::getTransientSettings().skipFrameRateLimit) { if (dusk::getTransientSettings().skipFrameRateLimit) {
p1 = OS_TIMER_CLOCK / 120; p1 = OS_TIMER_CLOCK / 120;
} }
#if TARGET_PC
if (fopOvlpM_IsPeek() && dusk::getTransientSettings().stateShareLoadActive) { if (fopOvlpM_IsPeek() && dusk::getTransientSettings().stateShareLoadActive) {
return; return;
} }
#endif
ZoneScopedC(tracy::Color::DimGray); ZoneScopedC(tracy::Color::DimGray);
#endif #endif
+8 -8
View File
@@ -559,7 +559,7 @@ void* operator new(size_t size) {
return JKRHeap::alloc(size, 4, NULL); return JKRHeap::alloc(size, 4, NULL);
} }
#else #else
void* operator new(size_t size JKR_HEAP_TOKEN_PARAM) noexcept { void* operator new(size_t size JKR_HEAP_TOKEN_PARAM) {
if (sCurrentHeap == NULL) { if (sCurrentHeap == NULL) {
return fallback_alloc(size, 0, false); return fallback_alloc(size, 0, false);
} }
@@ -576,7 +576,7 @@ void* operator new(size_t size, int alignment) {
return JKRHeap::alloc(size, alignment, NULL); return JKRHeap::alloc(size, alignment, NULL);
} }
#else #else
void* operator new(size_t size JKR_HEAP_TOKEN_PARAM, int alignment) noexcept { void* operator new(size_t size JKR_HEAP_TOKEN_PARAM, int alignment) {
void* mem = JKRHeap::alloc(size, alignment, nullptr); void* mem = JKRHeap::alloc(size, alignment, nullptr);
if (mem == nullptr) { if (mem == nullptr) {
return fallback_alloc(size, abs(alignment), true); return fallback_alloc(size, abs(alignment), true);
@@ -585,7 +585,7 @@ void* operator new(size_t size JKR_HEAP_TOKEN_PARAM, int alignment) noexcept {
} }
#endif #endif
void* operator new(size_t size JKR_HEAP_TOKEN_PARAM, JKRHeap* heap, int alignment) IF_DUSK(noexcept) { void* operator new(size_t size JKR_HEAP_TOKEN_PARAM, JKRHeap* heap, int alignment) {
void* mem = JKRHeap::alloc(size, alignment, heap); void* mem = JKRHeap::alloc(size, alignment, heap);
#if TARGET_PC #if TARGET_PC
if (mem == nullptr) { if (mem == nullptr) {
@@ -600,7 +600,7 @@ void* operator new[](size_t size) {
return JKRHeap::alloc(size, 4, NULL); return JKRHeap::alloc(size, 4, NULL);
} }
#else #else
void* operator new[](size_t JKR_HEAP_TOKEN_PARAM) IF_DUSK(noexcept) { void* operator new[](size_t JKR_HEAP_TOKEN_PARAM) {
OSPanic(__FILE__, __LINE__, "Allocation should go through JKR_NEW_ARRAY instead"); OSPanic(__FILE__, __LINE__, "Allocation should go through JKR_NEW_ARRAY instead");
} }
#endif #endif
@@ -610,12 +610,12 @@ void* operator new[](size_t size, int alignment) {
return JKRHeap::alloc(size, alignment, NULL); return JKRHeap::alloc(size, alignment, NULL);
} }
#else #else
void* operator new[](size_t JKR_HEAP_TOKEN_PARAM, int) IF_DUSK(noexcept) { void* operator new[](size_t JKR_HEAP_TOKEN_PARAM, int) {
OSPanic(__FILE__, __LINE__, "Allocation should go through JKR_NEW_ARRAY instead"); OSPanic(__FILE__, __LINE__, "Allocation should go through JKR_NEW_ARRAY instead");
} }
#endif #endif
void* operator new[](size_t JKR_HEAP_TOKEN_PARAM, JKRHeap*, int) IF_DUSK(noexcept) { void* operator new[](size_t JKR_HEAP_TOKEN_PARAM, JKRHeap*, int) {
OSPanic(__FILE__, __LINE__, "Allocation should go through JKR_NEW_ARRAY instead"); OSPanic(__FILE__, __LINE__, "Allocation should go through JKR_NEW_ARRAY instead");
} }
@@ -624,7 +624,7 @@ void operator delete(void* ptr) {
JKRHeap::free(ptr, NULL); JKRHeap::free(ptr, NULL);
} }
#else #else
void operator delete(void* ptr JKR_HEAP_TOKEN_PARAM) IF_DUSK(noexcept) { void operator delete(void* ptr JKR_HEAP_TOKEN_PARAM) {
if (ptr == NULL) if (ptr == NULL)
return; return;
JKRHeap* heap = JKRHeap::findFromRoot(ptr); JKRHeap* heap = JKRHeap::findFromRoot(ptr);
@@ -645,7 +645,7 @@ void operator delete[](void* ptr) {
JKRHeap::free(ptr, NULL); JKRHeap::free(ptr, NULL);
} }
#else #else
void operator delete[](void* ptr JKR_HEAP_TOKEN_PARAM) IF_DUSK(noexcept) { void operator delete[](void* ptr JKR_HEAP_TOKEN_PARAM) {
if (ptr == NULL) if (ptr == NULL)
return; return;
JKRHeap* heap = JKRHeap::findFromRoot(ptr); JKRHeap* heap = JKRHeap::findFromRoot(ptr);
@@ -655,7 +655,7 @@ value_or_fun:
value: value:
#if TARGET_PC #if TARGET_PC
if (dusk::frame_interp::is_enabled() && u <= 5 && if (dusk::getSettings().game.enableFrameInterpolation && u <= 5 &&
(operation == data::UNK_0x2 || operation == data::UNK_0x3 || operation == data::UNK_0x12)) (operation == data::UNK_0x2 || operation == data::UNK_0x3 || operation == data::UNK_0x12))
{ {
dusk::frame_interp::request_presentation_sync(); dusk::frame_interp::request_presentation_sync();
@@ -666,7 +666,7 @@ value:
value_n: value_n:
#if TARGET_PC #if TARGET_PC
if (dusk::frame_interp::is_enabled() && if (dusk::getSettings().game.enableFrameInterpolation &&
(pN == TAdaptor_camera::sauVariableValue_3_POSITION_XYZ || pN == TAdaptor_camera::sauVariableValue_3_TARGET_POSITION_XYZ) && (pN == TAdaptor_camera::sauVariableValue_3_POSITION_XYZ || pN == TAdaptor_camera::sauVariableValue_3_TARGET_POSITION_XYZ) &&
(operation == data::UNK_0x2 || operation == data::UNK_0x3 || operation == data::UNK_0x12)) (operation == data::UNK_0x2 || operation == data::UNK_0x3 || operation == data::UNK_0x12))
{ {
+2 -2
View File
@@ -5990,7 +5990,7 @@ void daAlink_c::setItemMatrix(int param_0) {
mDoMtx_stack_c::XrotS(-0x8000); mDoMtx_stack_c::XrotS(-0x8000);
#ifdef TARGET_PC #ifdef TARGET_PC
if (dusk::frame_interp::is_enabled()) { if (dusk::getSettings().game.enableFrameInterpolation) {
Mtx boot_mtx; Mtx boot_mtx;
mDoMtx_concat(mpLinkModel->getAnmMtx(0x18), mDoMtx_stack_c::get(), boot_mtx); mDoMtx_concat(mpLinkModel->getAnmMtx(0x18), mDoMtx_stack_c::get(), boot_mtx);
mpLinkBootModels[1]->setAnmMtx(1, boot_mtx); mpLinkBootModels[1]->setAnmMtx(1, boot_mtx);
@@ -19767,7 +19767,7 @@ int daAlink_c::draw() {
dComIfGd_getOpaListDark()->entryImm(mpHookChain, 0); dComIfGd_getOpaListDark()->entryImm(mpHookChain, 0);
#if TARGET_PC #if TARGET_PC
if (dusk::frame_interp::is_enabled() && if (dusk::getSettings().game.enableFrameInterpolation &&
mEquipItem == dItemNo_IRONBALL_e && mEquipItem == dItemNo_IRONBALL_e &&
mIronBallChainPos != NULL && mIronBallChainAngle != NULL) mIronBallChainPos != NULL && mIronBallChainAngle != NULL)
{ {
+1 -1
View File
@@ -397,7 +397,7 @@ static int daB_GND_Draw(b_gnd_class* i_this) {
i_this->field_0x21e8.update(2, l_color, &a_this->tevStr); i_this->field_0x21e8.update(2, l_color, &a_this->tevStr);
dComIfGd_set3DlineMat(&i_this->field_0x21e8); dComIfGd_set3DlineMat(&i_this->field_0x21e8);
#if TARGET_PC #if TARGET_PC
if (dusk::frame_interp::is_enabled()) { if (dusk::getSettings().game.enableFrameInterpolation) {
if (i_this->mReinsInterpCurrValid) { if (i_this->mReinsInterpCurrValid) {
memcpy(i_this->mReinsInterpPrev, i_this->mReinsInterpCurr, sizeof(i_this->mReinsInterpCurr)); memcpy(i_this->mReinsInterpPrev, i_this->mReinsInterpCurr, sizeof(i_this->mReinsInterpCurr));
memcpy(i_this->mReinsTexInterpPrev, i_this->mReinsTexInterpCurr, sizeof(i_this->mReinsTexInterpCurr)); memcpy(i_this->mReinsTexInterpPrev, i_this->mReinsTexInterpCurr, sizeof(i_this->mReinsTexInterpCurr));
-22
View File
@@ -674,29 +674,7 @@ static int daE_ARROW_Create(fopAc_ac_c* i_this) {
} }
int phase_state = dComIfG_resLoad(&a_this->mPhase, a_this->mResName); int phase_state = dComIfG_resLoad(&a_this->mPhase, a_this->mResName);
#if TARGET_PC
static int s_create_frames = 0;
static bool s_first_arrow = true;
static fpc_ProcID s_last_scene_id = 0;
s_create_frames++;
fpc_ProcID cur_scene_id = dStage_roomControl_c::getProcID();
if (cur_scene_id != s_last_scene_id) {
s_first_arrow = true;
s_last_scene_id = cur_scene_id;
}
if (phase_state == cPhs_COMPLEATE_e && s_first_arrow && s_create_frames < 4) {
return cPhs_INIT_e;
}
#endif
if (phase_state == cPhs_COMPLEATE_e) { if (phase_state == cPhs_COMPLEATE_e) {
#if TARGET_PC
s_create_frames = 0;
s_first_arrow = false;
#endif
a_this->mArrowType = fopAcM_GetParam(a_this) & 0xF; a_this->mArrowType = fopAcM_GetParam(a_this) & 0xF;
a_this->mFlags = fopAcM_GetParam(a_this) & 0xF0; a_this->mFlags = fopAcM_GetParam(a_this) & 0xF0;
+1 -1
View File
@@ -116,7 +116,7 @@ static int daE_DB_Draw(e_db_class* i_this) {
i_this->stalkLine.update(12, l_color, &actor->tevStr); i_this->stalkLine.update(12, l_color, &actor->tevStr);
dComIfGd_set3DlineMat(&i_this->stalkLine); dComIfGd_set3DlineMat(&i_this->stalkLine);
#if TARGET_PC #if TARGET_PC
if (dusk::frame_interp::is_enabled()) { if (dusk::getSettings().game.enableFrameInterpolation) {
if (i_this->mStalkLineInterpCurrValid) { if (i_this->mStalkLineInterpCurrValid) {
memcpy(i_this->mStalkLineInterpPrev, i_this->mStalkLineInterpCurr, sizeof(i_this->mStalkLineInterpCurr)); memcpy(i_this->mStalkLineInterpPrev, i_this->mStalkLineInterpCurr, sizeof(i_this->mStalkLineInterpCurr));
i_this->mStalkLineInterpPrevValid = true; i_this->mStalkLineInterpPrevValid = true;
+1 -1
View File
@@ -103,7 +103,7 @@ static int daE_HB_Draw(e_hb_class* i_this) {
i_this->stalkLine.update(12, l_color, &actor->tevStr); i_this->stalkLine.update(12, l_color, &actor->tevStr);
dComIfGd_set3DlineMat(&i_this->stalkLine); dComIfGd_set3DlineMat(&i_this->stalkLine);
#if TARGET_PC #if TARGET_PC
if (dusk::frame_interp::is_enabled()) { if (dusk::getSettings().game.enableFrameInterpolation) {
if (i_this->mStalkLineInterpCurrValid) { if (i_this->mStalkLineInterpCurrValid) {
memcpy(i_this->mStalkLineInterpPrev, i_this->mStalkLineInterpCurr, sizeof(i_this->mStalkLineInterpCurr)); memcpy(i_this->mStalkLineInterpPrev, i_this->mStalkLineInterpCurr, sizeof(i_this->mStalkLineInterpCurr));
i_this->mStalkLineInterpPrevValid = true; i_this->mStalkLineInterpPrevValid = true;
+1 -1
View File
@@ -105,7 +105,7 @@ static int daE_MB_Draw(e_mb_class* i_this) {
i_this->mRopeMat.update(16, l_color, &a_this->tevStr); i_this->mRopeMat.update(16, l_color, &a_this->tevStr);
dComIfGd_set3DlineMat(&i_this->mRopeMat); dComIfGd_set3DlineMat(&i_this->mRopeMat);
#if TARGET_PC #if TARGET_PC
if (dusk::frame_interp::is_enabled()) { if (dusk::getSettings().game.enableFrameInterpolation) {
if (i_this->mRopeInterpCurrValid) { if (i_this->mRopeInterpCurrValid) {
memcpy(i_this->mRopeInterpPrev, i_this->mRopeInterpCurr, sizeof(i_this->mRopeInterpCurr)); memcpy(i_this->mRopeInterpPrev, i_this->mRopeInterpCurr, sizeof(i_this->mRopeInterpCurr));
i_this->mRopeInterpPrevValid = true; i_this->mRopeInterpPrevValid = true;
+1 -8
View File
@@ -117,13 +117,6 @@ static void daE_S1_interp_callback(bool isSimFrame, void* pUserWork) {
dst[i] = p0 + (p1 - p0) * alpha; dst[i] = p0 + (p1 - p0) * alpha;
} }
} }
GXColor line_color;
line_color.r = JREG_S(0) + 5;
line_color.g = JREG_S(1) + 10;
line_color.b = JREG_S(2) + 10;
line_color.a = 0xFF;
i_this->mLineMat.update(16, line_color, &i_this->tevStr);
} }
#endif #endif
@@ -161,7 +154,7 @@ static int daE_S1_Draw(e_s1_class* i_this) {
dComIfGd_set3DlineMatDark(&i_this->mLineMat); dComIfGd_set3DlineMatDark(&i_this->mLineMat);
#if TARGET_PC #if TARGET_PC
if (dusk::frame_interp::is_enabled()) { if (dusk::getSettings().game.enableFrameInterpolation) {
if (i_this->mHairInterpCurrValid) { if (i_this->mHairInterpCurrValid) {
memcpy(i_this->mHairInterpPrev, i_this->mHairInterpCurr, sizeof(i_this->mHairInterpCurr)); memcpy(i_this->mHairInterpPrev, i_this->mHairInterpCurr, sizeof(i_this->mHairInterpCurr));
i_this->mHairInterpPrevValid = true; i_this->mHairInterpPrevValid = true;
+1 -1
View File
@@ -535,7 +535,7 @@ static int daE_WB_Draw(e_wb_class* i_this) {
i_this->himo_tex.update(2, l_color, &actor->tevStr); i_this->himo_tex.update(2, l_color, &actor->tevStr);
dComIfGd_set3DlineMat(&i_this->himo_tex); dComIfGd_set3DlineMat(&i_this->himo_tex);
#if TARGET_PC #if TARGET_PC
if (dusk::frame_interp::is_enabled()) { if (dusk::getSettings().game.enableFrameInterpolation) {
if (i_this->himo_interp_curr_valid) { if (i_this->himo_interp_curr_valid) {
memcpy(i_this->himo_mat_interp_prev, i_this->himo_mat_interp_curr, sizeof(i_this->himo_mat_interp_curr)); memcpy(i_this->himo_mat_interp_prev, i_this->himo_mat_interp_curr, sizeof(i_this->himo_mat_interp_curr));
memcpy(i_this->himo_tex_interp_prev, i_this->himo_tex_interp_curr, sizeof(i_this->himo_tex_interp_curr)); memcpy(i_this->himo_tex_interp_prev, i_this->himo_tex_interp_curr, sizeof(i_this->himo_tex_interp_curr));
+1 -1
View File
@@ -107,7 +107,7 @@ static s32 daE_YD_Draw(e_yd_class* i_this) {
i_this->mLineMat.update(12, l_color, &i_this->actor.tevStr); i_this->mLineMat.update(12, l_color, &i_this->actor.tevStr);
dComIfGd_set3DlineMat(&i_this->mLineMat); dComIfGd_set3DlineMat(&i_this->mLineMat);
#if TARGET_PC #if TARGET_PC
if (dusk::frame_interp::is_enabled()) { if (dusk::getSettings().game.enableFrameInterpolation) {
if (i_this->mLineMatInterpCurrValid) { if (i_this->mLineMatInterpCurrValid) {
memcpy(i_this->mLineMatInterpPrev, i_this->mLineMatInterpCurr, sizeof(i_this->mLineMatInterpCurr)); memcpy(i_this->mLineMatInterpPrev, i_this->mLineMatInterpCurr, sizeof(i_this->mLineMatInterpCurr));
i_this->mLineMatInterpPrevValid = true; i_this->mLineMatInterpPrevValid = true;
+1 -9
View File
@@ -139,7 +139,6 @@ static BOOL pl_check(e_yg_class* i_this, f32 i_dist) {
#if TARGET_PC #if TARGET_PC
static void daE_YG_interp_callback(bool isSimFrame, void* pUserWork) { static void daE_YG_interp_callback(bool isSimFrame, void* pUserWork) {
e_yg_class* i_this = (e_yg_class*)pUserWork; e_yg_class* i_this = (e_yg_class*)pUserWork;
fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor;
if (!i_this->mTentacleInterpPrevValid || !i_this->mTentacleInterpCurrValid) { if (!i_this->mTentacleInterpPrevValid || !i_this->mTentacleInterpCurrValid) {
return; return;
} }
@@ -153,13 +152,6 @@ static void daE_YG_interp_callback(bool isSimFrame, void* pUserWork) {
dst[i] = p0 + (p1 - p0) * alpha; dst[i] = p0 + (p1 - p0) * alpha;
} }
} }
GXColor color;
color.r = JREG_S(0) + 20;
color.g = JREG_S(1) + 20;
color.b = JREG_S(2) + 20;
color.a = 0xFF;
i_this->mLineMat.update(10, color, &actor->tevStr);
} }
#endif #endif
@@ -191,7 +183,7 @@ static int daE_YG_Draw(e_yg_class* i_this) {
dComIfGd_set3DlineMatDark(&i_this->mLineMat); dComIfGd_set3DlineMatDark(&i_this->mLineMat);
#if TARGET_PC #if TARGET_PC
if (dusk::frame_interp::is_enabled()) { if (dusk::getSettings().game.enableFrameInterpolation) {
if (i_this->mTentacleInterpCurrValid) { if (i_this->mTentacleInterpCurrValid) {
memcpy(i_this->mTentacleInterpPrev, i_this->mTentacleInterpCurr, sizeof(i_this->mTentacleInterpCurr)); memcpy(i_this->mTentacleInterpPrev, i_this->mTentacleInterpCurr, sizeof(i_this->mTentacleInterpCurr));
i_this->mTentacleInterpPrevValid = true; i_this->mTentacleInterpPrevValid = true;
+1 -1
View File
@@ -135,7 +135,7 @@ static int daE_YH_Draw(e_yh_class* i_this) {
i_this->mLine.update(12, l_color, &a_this->tevStr); i_this->mLine.update(12, l_color, &a_this->tevStr);
dComIfGd_set3DlineMat(&i_this->mLine); dComIfGd_set3DlineMat(&i_this->mLine);
#if TARGET_PC #if TARGET_PC
if (dusk::frame_interp::is_enabled()) { if (dusk::getSettings().game.enableFrameInterpolation) {
if (i_this->mLineInterpCurrValid) { if (i_this->mLineInterpCurrValid) {
memcpy(i_this->mLineInterpPrev, i_this->mLineInterpCurr, sizeof(i_this->mLineInterpCurr)); memcpy(i_this->mLineInterpPrev, i_this->mLineInterpCurr, sizeof(i_this->mLineInterpCurr));
i_this->mLineInterpPrevValid = true; i_this->mLineInterpPrevValid = true;
+1 -1
View File
@@ -3165,7 +3165,7 @@ void daHorse_c::setReinPosNormalSubstance() {
#if TARGET_PC #if TARGET_PC
void daHorse_c::lerpControlPoints(f32 alpha) { void daHorse_c::lerpControlPoints(f32 alpha) {
// FRAME INTERP NOTE: Currently only lerping points for Epona's reins. Need a more global solution. // FRAME INTERP NOTE: Currently only lerping points for Epona's reins. Need a more global solution.
if (!dusk::frame_interp::is_enabled() || !s_horseReinSimPrevValid || !s_horseReinSimCurrValid) { if (!dusk::getSettings().game.enableFrameInterpolation || !s_horseReinSimPrevValid || !s_horseReinSimCurrValid) {
return; return;
} }
const int nCurr = s_horseReinSimNumCurr; const int nCurr = s_horseReinSimNumCurr;
+1 -1
View File
@@ -325,7 +325,7 @@ int daObjFchain_c::draw() {
dComIfGd_getOpaListDark()->entryImm(&mShape, 0); dComIfGd_getOpaListDark()->entryImm(&mShape, 0);
#if TARGET_PC #if TARGET_PC
if (dusk::frame_interp::is_enabled()) { if (dusk::getSettings().game.enableFrameInterpolation) {
if (mChainInterpCurrValid) { if (mChainInterpCurrValid) {
memcpy(mChainInterpPrev, mChainInterpCurr, sizeof(mChainInterpCurr)); memcpy(mChainInterpPrev, mChainInterpCurr, sizeof(mChainInterpCurr));
mChainInterpPrevValid = true; mChainInterpPrevValid = true;
+1 -1
View File
@@ -493,7 +493,7 @@ int daObjKLift00_c::Draw() {
dComIfGd_setList(); dComIfGd_setList();
#if TARGET_PC #if TARGET_PC
if (dusk::frame_interp::is_enabled()) { if (dusk::getSettings().game.enableFrameInterpolation) {
if (mChainInterpCurrValid) { if (mChainInterpCurrValid) {
memcpy(mChainInterpPrev, mChainInterpCurr, mNumChains * sizeof(cXyz)); memcpy(mChainInterpPrev, mChainInterpCurr, mNumChains * sizeof(cXyz));
mChainInterpPrevValid = true; mChainInterpPrevValid = true;
+2 -2
View File
@@ -170,7 +170,7 @@ int daTitle_c::Execute() {
} }
#ifdef TARGET_PC #ifdef TARGET_PC
if (!dusk::frame_interp::is_enabled()) { if (!dusk::getSettings().game.enableFrameInterpolation) {
#endif #endif
dMenu_Collect3D_c::setViewPortOffsetY(0.0f); dMenu_Collect3D_c::setViewPortOffsetY(0.0f);
#ifdef TARGET_PC #ifdef TARGET_PC
@@ -354,7 +354,7 @@ void daTitle_c::fastLogoDispInit() {
mProcID = 5; mProcID = 5;
#ifdef TARGET_PC #ifdef TARGET_PC
if (dusk::frame_interp::is_enabled()) { if (dusk::getSettings().game.enableFrameInterpolation) {
dusk::frame_interp::request_presentation_sync(); dusk::frame_interp::request_presentation_sync();
} }
#endif #endif
+10 -10
View File
@@ -13,7 +13,7 @@ const u16 l_J_Ohana00_64TEX__height = 63;
#if TARGET_PC #if TARGET_PC
#include "dusk/dvd_asset.hpp" #include "dusk/dvd_asset.hpp"
using GameVersion = dusk::version::GameVersion; using GameVersion = dusk::version::GameVersion;
static u8* l_J_Ohana00_64TEX_get() { static u8 buf[0x800]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x9060}, {GameVersion::GcnPal, 0x9060}}, 0x800), true); return buf; } static u8* l_J_Ohana00_64TEX_get() { static u8 buf[0x800]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x9060}, {GameVersion::GcnPal, 0x9060}, {GameVersion::GcnJpn, 0x9060}}, 0x800), true); return buf; }
#define l_J_Ohana00_64TEX (l_J_Ohana00_64TEX_get()) #define l_J_Ohana00_64TEX (l_J_Ohana00_64TEX_get())
#else #else
#include "assets/l_J_Ohana00_64TEX.h" #include "assets/l_J_Ohana00_64TEX.h"
@@ -111,10 +111,10 @@ static u8 l_flowerTexCoord[] = {
#if TARGET_PC #if TARGET_PC
using GameVersion = dusk::version::GameVersion; using GameVersion = dusk::version::GameVersion;
static u8* l_J_hana00DL_get() { static u8 buf[0x150]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x9D20}, {GameVersion::GcnPal, 0x9D20}}, 0x150), true); return buf; } static u8* l_J_hana00DL_get() { static u8 buf[0x150]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x9D20}, {GameVersion::GcnPal, 0x9D20}, {GameVersion::GcnJpn, 0x9D20}}, 0x150), true); return buf; }
static u8* l_J_hana00_cDL_get() { static u8 buf[0xDE]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x9E80}, {GameVersion::GcnPal, 0x9E80}}, 0xDE), true); return buf; } static u8* l_J_hana00_cDL_get() { static u8 buf[0xDE]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x9E80}, {GameVersion::GcnPal, 0x9E80}, {GameVersion::GcnJpn, 0x9E80}}, 0xDE), true); return buf; }
static u8* l_matDL_get() { static u8 buf[0x99]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x9F60}, {GameVersion::GcnPal, 0x9F60}}, 0x99), true); return buf; } static u8* l_matDL_get() { static u8 buf[0x99]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x9F60}, {GameVersion::GcnPal, 0x9F60}, {GameVersion::GcnJpn, 0x9F60}}, 0x99), true); return buf; }
static u8* l_matLight4DL_get() { static u8 buf[0x99]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0xA000}, {GameVersion::GcnPal, 0xA000}}, 0x99), true); return buf; } static u8* l_matLight4DL_get() { static u8 buf[0x99]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0xA000}, {GameVersion::GcnPal, 0xA000}, {GameVersion::GcnJpn, 0xA000}}, 0x99), true); return buf; }
#define l_J_hana00DL (l_J_hana00DL_get()) #define l_J_hana00DL (l_J_hana00DL_get())
#define l_J_hana00_cDL (l_J_hana00_cDL_get()) #define l_J_hana00_cDL (l_J_hana00_cDL_get())
#define l_matDL (l_matDL_get()) #define l_matDL (l_matDL_get())
@@ -270,11 +270,11 @@ static u8 l_flowerTexCoord2[] = {
#if TARGET_PC #if TARGET_PC
using GameVersion = dusk::version::GameVersion; using GameVersion = dusk::version::GameVersion;
static u8* l_J_hana01DL_get() { static u8 buf[0x138]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0xB7C0}, {GameVersion::GcnPal, 0xB7C0}}, 0x138), true); return buf; } static u8* l_J_hana01DL_get() { static u8 buf[0x138]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0xB7C0}, {GameVersion::GcnPal, 0xB7C0}, {GameVersion::GcnJpn, 0xB7C0}}, 0x138), true); return buf; }
static u8* l_J_hana01_c_00DL_get() { static u8 buf[0xDE]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0xB900}, {GameVersion::GcnPal, 0xB900}}, 0xDE), true); return buf; } static u8* l_J_hana01_c_00DL_get() { static u8 buf[0xDE]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0xB900}, {GameVersion::GcnPal, 0xB900}, {GameVersion::GcnJpn, 0xB900}}, 0xDE), true); return buf; }
static u8* l_J_hana01_c_01DL_get() { static u8 buf[0x128]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0xB9E0}, {GameVersion::GcnPal, 0xB9E0}}, 0x128), true); return buf; } static u8* l_J_hana01_c_01DL_get() { static u8 buf[0x128]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0xB9E0}, {GameVersion::GcnPal, 0xB9E0}, {GameVersion::GcnJpn, 0xB9E0}}, 0x128), true); return buf; }
static u8* l_mat2DL_get() { static u8 buf[0x99]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0xBB20}, {GameVersion::GcnPal, 0xBB20}}, 0x99), true); return buf; } static u8* l_mat2DL_get() { static u8 buf[0x99]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0xBB20}, {GameVersion::GcnPal, 0xBB20}, {GameVersion::GcnJpn, 0xBB20}}, 0x99), true); return buf; }
static u8* l_mat2Light4DL_get() { static u8 buf[0x99]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0xBBC0}, {GameVersion::GcnPal, 0xBBC0}}, 0x99), true); return buf; } static u8* l_mat2Light4DL_get() { static u8 buf[0x99]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0xBBC0}, {GameVersion::GcnPal, 0xBBC0}, {GameVersion::GcnJpn, 0xBBC0}}, 0x99), true); return buf; }
#define l_J_hana01DL (l_J_hana01DL_get()) #define l_J_hana01DL (l_J_hana01DL_get())
#define l_J_hana01_c_00DL (l_J_hana01_c_00DL_get()) #define l_J_hana01_c_00DL (l_J_hana01_c_00DL_get())
#define l_J_hana01_c_01DL (l_J_hana01_c_01DL_get()) #define l_J_hana01_c_01DL (l_J_hana01_c_01DL_get())
+8 -8
View File
@@ -21,8 +21,8 @@ const u16 l_M_kusa05_RGBATEX__height = 31;
#if TARGET_PC #if TARGET_PC
#include "dusk/dvd_asset.hpp" #include "dusk/dvd_asset.hpp"
using GameVersion = dusk::version::GameVersion; using GameVersion = dusk::version::GameVersion;
static u8* l_M_kusa05_RGBATEX_get() { static u8 buf[0x800]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x7680}, {GameVersion::GcnPal, 0x7680}}, 0x800), true); return buf; } static u8* l_M_kusa05_RGBATEX_get() { static u8 buf[0x800]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x7680}, {GameVersion::GcnPal, 0x7680}, {GameVersion::GcnJpn, 0x7680}}, 0x800), true); return buf; }
static u8* l_M_Hijiki00TEX_get() { static u8 buf[0x800]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x7E80}, {GameVersion::GcnPal, 0x7E80}}, 0x800), true); return buf; } static u8* l_M_Hijiki00TEX_get() { static u8 buf[0x800]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x7E80}, {GameVersion::GcnPal, 0x7E80}, {GameVersion::GcnJpn, 0x7E80}}, 0x800), true); return buf; }
#define l_M_kusa05_RGBATEX (l_M_kusa05_RGBATEX_get()) #define l_M_kusa05_RGBATEX (l_M_kusa05_RGBATEX_get())
#define l_M_Hijiki00TEX (l_M_Hijiki00TEX_get()) #define l_M_Hijiki00TEX (l_M_Hijiki00TEX_get())
#else #else
@@ -116,12 +116,12 @@ static u8 l_texCoord[160] = {
#if TARGET_PC #if TARGET_PC
using GameVersion = dusk::version::GameVersion; using GameVersion = dusk::version::GameVersion;
static u8* l_M_Kusa_9qDL_get() { static u8 buf[0xCB]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x8B00}, {GameVersion::GcnPal, 0x8B00}}, 0xCB), true); return buf; } static u8* l_M_Kusa_9qDL_get() { static u8 buf[0xCB]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x8B00}, {GameVersion::GcnPal, 0x8B00}, {GameVersion::GcnJpn, 0x8B00}}, 0xCB), true); return buf; }
static u8* l_M_Kusa_9q_cDL_get() { static u8 buf[0xCB]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x8BE0}, {GameVersion::GcnPal, 0x8BE0}}, 0xCB), true); return buf; } static u8* l_M_Kusa_9q_cDL_get() { static u8 buf[0xCB]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x8BE0}, {GameVersion::GcnPal, 0x8BE0}, {GameVersion::GcnJpn, 0x8BE0}}, 0xCB), true); return buf; }
static u8* l_M_TenGusaDL_get() { static u8 buf[0xD4]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x8CC0}, {GameVersion::GcnPal, 0x8CC0}}, 0xD4), true); return buf; } static u8* l_M_TenGusaDL_get() { static u8 buf[0xD4]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x8CC0}, {GameVersion::GcnPal, 0x8CC0}, {GameVersion::GcnJpn, 0x8CC0}}, 0xD4), true); return buf; }
static u8* l_Tengusa_matDL_get() { static u8 buf[0xA8]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x8DA0}, {GameVersion::GcnPal, 0x8DA0}}, 0xA8), true); return buf; } static u8* l_Tengusa_matDL_get() { static u8 buf[0xA8]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x8DA0}, {GameVersion::GcnPal, 0x8DA0}, {GameVersion::GcnJpn, 0x8DA0}}, 0xA8), true); return buf; }
static u8* l_kusa9q_matDL_get() { static u8 buf[0xA8]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x8E60}, {GameVersion::GcnPal, 0x8E60}}, 0xA8), true); return buf; } static u8* l_kusa9q_matDL_get() { static u8 buf[0xA8]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x8E60}, {GameVersion::GcnPal, 0x8E60}, {GameVersion::GcnJpn, 0x8E60}}, 0xA8), true); return buf; }
static u8* l_kusa9q_l4_matDL_get() { static u8 buf[0xA8]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x8F20}, {GameVersion::GcnPal, 0x8F20}}, 0xA8), true); return buf; } static u8* l_kusa9q_l4_matDL_get() { static u8 buf[0xA8]; static bool _ = (dusk::LoadArchivedRelAsset(buf, 'AMEM', "d_a_grass.rel", {{GameVersion::GcnUsa, 0x8F20}, {GameVersion::GcnPal, 0x8F20}, {GameVersion::GcnJpn, 0x8F20}}, 0xA8), true); return buf; }
#define l_M_Kusa_9qDL (l_M_Kusa_9qDL_get()) #define l_M_Kusa_9qDL (l_M_Kusa_9qDL_get())
#define l_M_Kusa_9q_cDL (l_M_Kusa_9q_cDL_get()) #define l_M_Kusa_9q_cDL (l_M_Kusa_9q_cDL_get())
#define l_M_TenGusaDL (l_M_TenGusaDL_get()) #define l_M_TenGusaDL (l_M_TenGusaDL_get())
+2 -2
View File
@@ -10431,7 +10431,7 @@ bool dCamera_c::eventCamera(s32 param_0) {
#endif #endif
#if TARGET_PC #if TARGET_PC
if (dusk::frame_interp::is_enabled()) { if (dusk::getSettings().game.enableFrameInterpolation) {
switch (var_r29) { switch (var_r29) {
case 3: case 3:
case 4: case 4:
@@ -11322,7 +11322,7 @@ static int camera_execute(camera_process_class* i_this) {
#ifdef TARGET_PC #ifdef TARGET_PC
widezoom_correction(i_this, i_this->mCamera.TrimHeight()); widezoom_correction(i_this, i_this->mCamera.TrimHeight());
if (dusk::frame_interp::is_enabled()) { if (dusk::getSettings().game.enableFrameInterpolation) {
dusk::frame_interp::add_interpolation_callback([](bool _, void* pUserWork) { dusk::frame_interp::add_interpolation_callback([](bool _, void* pUserWork) {
const auto i_this = static_cast<camera_process_class*>(pUserWork); const auto i_this = static_cast<camera_process_class*>(pUserWork);
const auto camera = &i_this->mCamera; const auto camera = &i_this->mCamera;
+2 -2
View File
@@ -991,7 +991,7 @@ void dMenu_DmapBg_c::draw() {
-35.0f + (local_224.x - local_218.x), -35.0f + (local_224.x - local_218.x),
-35.0f + (local_224.y - local_218.y)); -35.0f + (local_224.y - local_218.y));
#if TARGET_PC #if TARGET_PC
if (!dusk::frame_interp::is_enabled()) { if (!dusk::getSettings().game.enableFrameInterpolation) {
field_0xdda = 0; field_0xdda = 0;
} }
#else #else
@@ -2624,7 +2624,7 @@ void dMenu_Dmap_c::zoomIn_proc() {
void dMenu_Dmap_c::zoomOut_init_proc() { void dMenu_Dmap_c::zoomOut_init_proc() {
#if TARGET_PC #if TARGET_PC
if (dusk::frame_interp::is_enabled()) { if (dusk::getSettings().game.enableFrameInterpolation) {
mpDrawBg->resetScrollArrowMask(); mpDrawBg->resetScrollArrowMask();
} }
#endif #endif
+1 -1
View File
@@ -1146,7 +1146,7 @@ void dMenu_Fmap_c::zoom_spot_to_region_init() {
field_0x1ec = 1.0f; field_0x1ec = 1.0f;
#if TARGET_PC #if TARGET_PC
// Frame interp note: field_0x122d used to be set every draw, causing flickering. Do it here instead. // Frame interp note: field_0x122d used to be set every draw, causing flickering. Do it here instead.
if (dusk::frame_interp::is_enabled()) { if (dusk::getSettings().game.enableFrameInterpolation) {
mpDraw2DBack->resetScrollArrowMask(); mpDraw2DBack->resetScrollArrowMask();
} }
#endif #endif
+1 -1
View File
@@ -437,7 +437,7 @@ void dMenu_Fmap2DBack_c::draw() {
if (field_0x122d) { if (field_0x122d) {
mpMeterHaihai->drawHaihai(field_0x122d); mpMeterHaihai->drawHaihai(field_0x122d);
#if TARGET_PC #if TARGET_PC
if (!dusk::frame_interp::is_enabled()) { if (!dusk::getSettings().game.enableFrameInterpolation) {
field_0x122d = 0; field_0x122d = 0;
} }
#else #else
-13
View File
@@ -18,9 +18,6 @@
#include "d/d_pane_class.h" #include "d/d_pane_class.h"
#include "dusk/frame_interpolation.h" #include "dusk/frame_interpolation.h"
#include <cstring> #include <cstring>
#if TARGET_PC
#include "dusk/string.hpp"
#endif
#if VERSION == VERSION_GCN_JPN #if VERSION == VERSION_GCN_JPN
#define STR_BUF_LEN 528 #define STR_BUF_LEN 528
@@ -2930,12 +2927,6 @@ bool dMeterButton_c::isClose() {
} }
void dMeterButton_c::setString(char* i_string, u8 i_button, u8 param_2, u8 param_3) { void dMeterButton_c::setString(char* i_string, u8 i_button, u8 param_2, u8 param_3) {
#if TARGET_PC
char* i_string_full = i_string;
char i_string_buf[sizeof(mButtonText[0])];
dusk::SafeStringCopyTruncate(i_string_buf, i_string);
i_string = i_string_buf;
#endif
if (strcmp(mButtonText[param_2], i_string) != 0 || field_0x4be[param_2] != i_button) { if (strcmp(mButtonText[param_2], i_string) != 0 || field_0x4be[param_2] != i_button) {
if (param_2 == 0 && strcmp(mButtonText[1], i_string) == 0 && if (param_2 == 0 && strcmp(mButtonText[1], i_string) == 0 &&
((i_button == BUTTON_A_e && field_0x4be[1] == BUTTON_A_e) || ((i_button == BUTTON_A_e && field_0x4be[1] == BUTTON_A_e) ||
@@ -3031,10 +3022,6 @@ void dMeterButton_c::setString(char* i_string, u8 i_button, u8 param_2, u8 param
strcpy(mButtonText[param_2], i_string); strcpy(mButtonText[param_2], i_string);
#if TARGET_PC
i_string = i_string_full;
#endif
if (param_2 == 0) { if (param_2 == 0) {
if (param_3 != 0) { if (param_3 != 0) {
field_0x4d9 = param_2; field_0x4d9 = param_2;
-8
View File
@@ -188,14 +188,6 @@ void dMsgScrnTree_c::exec() {
fukiAlpha(1.0f); fukiAlpha(1.0f);
} }
mpPmP_c->scale(g_MsgObject_HIO_c.mBoxWoodScaleX, g_MsgObject_HIO_c.mBoxWoodScaleY); mpPmP_c->scale(g_MsgObject_HIO_c.mBoxWoodScaleX, g_MsgObject_HIO_c.mBoxWoodScaleY);
#if TARGET_PC
const f32 hudScale = mDoGph_gInf_c::hudAspectScaleUp;
if (hudScale > 1.0f) {
field_0xc4->getPanePtr()->setBasePosition(J2DBasePosition_4);
field_0xc4->getPanePtr()->scale(hudScale, 1.0f);
}
#endif
} }
void dMsgScrnTree_c::draw() { void dMsgScrnTree_c::draw() {
+57
View File
@@ -17,6 +17,62 @@ static bool isPalOrJpn() {
return dusk::version::isRegionPal() || dusk::version::isRegionJpn(); return dusk::version::isRegionPal() || dusk::version::isRegionJpn();
} }
#if TARGET_PC
static const char* l_mojiHira[65] = {
"\x82\xA0", "\x82\xA2", "\x82\xA4", "\x82\xA6", "\x82\xA8", "\x82\xA9", "\x82\xAB", "\x82\xAD", "\x82\xAF", "\x82\xB1", "\x82\xB3", "\x82\xB5", "\x82\xB7",
"\x82\xB9", "\x82\xBB", "\x82\xBD", "\x82\xBF", "\x82\xC2", "\x82\xC4", "\x82\xC6", "\x82\xC8", "\x82\xC9", "\x82\xCA", "\x82\xCB", "\x82\xCC", "\x82\xCD",
"\x82\xD0", "\x82\xD3", "\x82\xD6", "\x82\xD9", "\x82\xDC", "\x82\xDD", "\x82\xDE", "\x82\xDF", "\x82\xE0", "\x82\xE2", "\x81\x40", "\x82\xE4", "\x81\x40",
"\x82\xE6", "\x82\xE7", "\x82\xE8", "\x82\xE9", "\x82\xEA", "\x82\xEB", "\x82\xED", "\x81\x40", "\x82\xF0", "\x81\x40", "\x82\xF1", "\x82\x9F", "\x82\xA1",
"\x82\xA3", "\x82\xA5", "\x82\xA7", "\x82\xE1", "\x81\x40", "\x82\xE3", "\x81\x40", "\x82\xE5", "\x82\xC1", "\x81\x40", "\x81\x5B", "\x81\x4A", "\x81\x4B",
};
static const char* l_mojiHira2[65] = {
"\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x82\xAA", "\x82\xAC", "\x82\xAE", "\x82\xB0", "\x82\xB2", "\x82\xB4", "\x82\xB6", "\x82\xB8",
"\x82\xBA", "\x82\xBC", "\x82\xBE", "\x82\xC0", "\x82\xC3", "\x82\xC5", "\x82\xC7", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x82\xCE",
"\x82\xD1", "\x82\xD4", "\x82\xD7", "\x82\xDA", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F",
"\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F",
"\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F",
};
static const char* l_mojiHira3[65] = {
"\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F",
"\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x82\xCF",
"\x82\xD2", "\x82\xD5", "\x82\xD8", "\x82\xDB", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F",
"\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F",
"\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F",
};
static const char* l_mojikata[65] = {
"\x83\x41", "\x83\x43", "\x83\x45", "\x83\x47", "\x83\x49", "\x83\x4A", "\x83\x4C", "\x83\x4E", "\x83\x50", "\x83\x52", "\x83\x54", "\x83\x56", "\x83\x58",
"\x83\x5A", "\x83\x5C", "\x83\x5E", "\x83\x60", "\x83\x63", "\x83\x65", "\x83\x67", "\x83\x69", "\x83\x6A", "\x83\x6B", "\x83\x6C", "\x83\x6D", "\x83\x6E",
"\x83\x71", "\x83\x74", "\x83\x77", "\x83\x7A", "\x83\x7D", "\x83\x7E", "\x83\x80", "\x83\x81", "\x83\x82", "\x83\x84", "\x81\x40", "\x83\x86", "\x81\x40",
"\x83\x88", "\x83\x89", "\x83\x8A", "\x83\x8B", "\x83\x8C", "\x83\x8D", "\x83\x8F", "\x81\x40", "\x83\x93", "\x81\x40", "\x83\x93", "\x83\x40", "\x83\x42"
"\x83\x44", "\x83\x46", "\x83\x48", "\x83\x83", "\x81\x40", "\x83\x85", "\x81\x40", "\x83\x87", "\x83\x62", "\x81\x40", "\x81\x5B", "\x81\x4A", "\x81\x4B",
};
static const char* l_mojikata2[65] = {
"\x81\x8F", "\x81\x8F", "\x83\x94", "\x81\x8F", "\x81\x8F", "\x83\x4B", "\x83\x4D", "\x83\x4F", "\x83\x51", "\x83\x53", "\x83\x55", "\x83\x57", "\x83\x59",
"\x83\x5B", "\x83\x5D", "\x83\x5F", "\x83\x61", "\x83\x64", "\x83\x66", "\x83\x68", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x83\x6F",
"\x83\x72", "\x83\x75", "\x83\x78", "\x83\x7B", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F",
"\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F",
"\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F",
};
static const char* l_mojikata3[65] = {
"\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F",
"\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x83\x70",
"\x83\x73", "\x83\x76", "\x83\x79", "\x83\x7C", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F",
"\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F",
"\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F", "\x81\x8F",
};
static const char* l_mojiEisu[65] = {
"A", "N", "a", "n", "1", "B", "O", "b", "o", "2", "C", "P", "c", "p", "3", "D", "Q",
"d", "q", "4", "E", "R", "e", "r", "5", "F", "S", "f", "s", "6", "G", "T", "g", "t",
"7", "H", "U", "h", "u", "8", "I", "V", "i", "v", "9", "J", "W", "j", "w", "0", "K",
"X", "k", "x", ",", "L", "Y", "l", "y", ".", "M", "Z", "m", "z", " ",
};
#else
static const char* l_mojiHira[65] = { static const char* l_mojiHira[65] = {
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
@@ -71,6 +127,7 @@ static const char* l_mojiEisu[65] = {
"7", "H", "U", "h", "u", "8", "I", "V", "i", "v", "9", "J", "W", "j", "w", "0", "K", "7", "H", "U", "h", "u", "8", "I", "V", "i", "v", "9", "J", "W", "j", "w", "0", "K",
"X", "k", "x", ",", "L", "Y", "l", "y", ".", "M", "Z", "m", "z", " ", "X", "k", "x", ",", "L", "Y", "l", "y", ".", "M", "Z", "m", "z", " ",
}; };
#endif
#if TARGET_PC #if TARGET_PC
// The game normally mutates this string list to fill in the real character codes. // The game normally mutates this string list to fill in the real character codes.
+8 -1
View File
@@ -907,7 +907,14 @@ dScnLogo_c::~dScnLogo_c() {
mDoExt_getRubyFont(); mDoExt_getRubyFont();
mDoExt_setAraCacheSize(free_size - aram_heap->getTotalFreeSize()); mDoExt_setAraCacheSize(free_size - aram_heap->getTotalFreeSize());
#if VERSION == VERSION_GCN_JPN #if TARGET_PC
if (getGameVersion() == GameVersion::GcnJpn) {
if (dComIfGp_getFontArchive() != NULL) {
dComIfGp_getFontArchive()->unmount();
dComIfGp_setFontArchive(NULL);
}
}
#elif VERSION == VERSION_GCN_JPN
if (dComIfGp_getFontArchive() != NULL) { if (dComIfGp_getFontArchive() != NULL) {
dComIfGp_getFontArchive()->unmount(); dComIfGp_getFontArchive()->unmount();
dComIfGp_setFontArchive(NULL); dComIfGp_setFontArchive(NULL);
-19
View File
@@ -56,23 +56,6 @@ static T sanitizeEnumValue(const ConfigVar<T>& cVar, T value) {
template<ConfigValue T> template<ConfigValue T>
void ConfigImpl<T>::loadFromJson(ConfigVar<T>& cVar, const json& jsonValue) { void ConfigImpl<T>::loadFromJson(ConfigVar<T>& cVar, const json& jsonValue) {
if constexpr (std::is_enum_v<T>) {
if (jsonValue.is_boolean()) {
using Underlying = std::underlying_type_t<T>;
const bool b = jsonValue.get<bool>();
Underlying raw;
if constexpr (std::is_same_v<T, dusk::FrameInterpMode>) {
raw = b ? static_cast<Underlying>(2) : static_cast<Underlying>(0);
} else {
raw = b ? static_cast<Underlying>(1) : static_cast<Underlying>(0);
}
cVar.setValue(sanitizeEnumValue(cVar, static_cast<T>(raw)), false);
return;
}
}
cVar.setValue(sanitizeEnumValue(cVar, jsonValue.get<T>()), false); cVar.setValue(sanitizeEnumValue(cVar, jsonValue.get<T>()), false);
} }
@@ -175,8 +158,6 @@ namespace dusk::config {
template class ConfigImpl<dusk::DiscVerificationState>; template class ConfigImpl<dusk::DiscVerificationState>;
template class ConfigImpl<dusk::GameLanguage>; template class ConfigImpl<dusk::GameLanguage>;
template class ConfigImpl<dusk::GyroMode>; template class ConfigImpl<dusk::GyroMode>;
template class ConfigImpl<dusk::FrameInterpMode>;
template class ConfigImpl<dusk::Resampler>;
} }
void dusk::config::Register(ConfigVarBase& configVar) { void dusk::config::Register(ConfigVarBase& configVar) {
+2 -2
View File
@@ -142,8 +142,8 @@ uint64_t sim_tick_seq() {
return g_sim_tick_seq; return g_sim_tick_seq;
} }
void begin_frame(FrameInterpMode mode, bool is_sim_frame, float step) { void begin_frame(bool enabled, bool is_sim_frame, float step) {
g_enabled = mode != FrameInterpMode::Off; g_enabled = enabled;
g_is_sim_frame = is_sim_frame; g_is_sim_frame = is_sim_frame;
g_step = std::clamp(step, 0.0f, 1.0f); g_step = std::clamp(step, 0.0f, 1.0f);
} }
+1 -3
View File
@@ -4,7 +4,6 @@
#include <chrono> #include <chrono>
#include <cmath> #include <cmath>
#include <unordered_map> #include <unordered_map>
#include <dusk/frame_interpolation.h>
namespace dusk::game_clock { namespace dusk::game_clock {
@@ -46,8 +45,7 @@ MainLoopPacer advance_main_loop() {
MainLoopPacer out{}; MainLoopPacer out{};
out.presentation_dt_seconds = presentation_dt; out.presentation_dt_seconds = presentation_dt;
const bool should_interpolate = dusk::getSettings().game.enableFrameInterpolation.getValue() != const bool should_interpolate = dusk::getSettings().game.enableFrameInterpolation &&
dusk::FrameInterpMode::Off &&
!dusk::getTransientSettings().skipFrameRateLimit; !dusk::getTransientSettings().skipFrameRateLimit;
out.is_interpolating = should_interpolate; out.is_interpolating = should_interpolate;
out.sim_pace = sim_pace(); out.sim_pace = sim_pace();
+1 -1
View File
@@ -713,7 +713,7 @@ namespace dusk {
transformLevel++; transformLevel++;
} }
} }
if (ImGui::SliderInt("Transform Level", &transformLevel, 0, 4)) { if (ImGui::SliderInt("Transform Level", &transformLevel, 0, 3)) {
u8 newFlags = 0; u8 newFlags = 0;
for (int i = 0; i < transformLevel; i++) { for (int i = 0; i < transformLevel; i++) {
newFlags |= (1 << i); newFlags |= (1 << i);
+8 -16
View File
@@ -60,18 +60,6 @@ const char* verification_state_name(dusk::DiscVerificationState state) noexcept
namespace dusk::iso { namespace dusk::iso {
enum class Platform : u8 {
GameCube,
Wii,
};
enum class Region : u8 {
NorthAmerica,
Europe,
Japan,
Korea,
};
struct KnownDisc { struct KnownDisc {
std::string_view id; std::string_view id;
Platform platform; Platform platform;
@@ -88,7 +76,7 @@ struct KnownDisc {
constexpr auto KNOWN_DISCS = std::to_array<KnownDisc>({ constexpr auto KNOWN_DISCS = std::to_array<KnownDisc>({
{"GZ2E01", Platform::GameCube, Region::NorthAmerica, "14e886f08e548a000afde98a3195e788"}, {"GZ2E01", Platform::GameCube, Region::NorthAmerica, "14e886f08e548a000afde98a3195e788"},
{"GZ2J01", Platform::GameCube, Region::Japan}, {"GZ2J01", Platform::GameCube, Region::Japan, "5967dc7a6a553652f4d2050aeef6f368"},
{"GZ2P01", Platform::GameCube, Region::Europe, "9ef597588b0035ca9e91b333fa9a8a7e"}, {"GZ2P01", Platform::GameCube, Region::Europe, "9ef597588b0035ca9e91b333fa9a8a7e"},
{"RZDE01", Platform::Wii, Region::NorthAmerica}, {"RZDE01", Platform::Wii, Region::NorthAmerica},
{"RZDJ01", Platform::Wii, Region::Japan}, {"RZDJ01", Platform::Wii, Region::Japan},
@@ -216,7 +204,9 @@ ValidationError validate(const char* path, VerificationStatus& status, DiscInfo&
return ValidationError::WrongGame; return ValidationError::WrongGame;
} }
status.knownDisc = knownDisc; status.knownDisc = knownDisc;
info.isPal = knownDisc->region == Region::Europe;
info.platform = knownDisc->platform;
info.region = knownDisc->region;
if (!knownDisc->supported) { if (!knownDisc->supported) {
return ValidationError::WrongVersion; return ValidationError::WrongVersion;
} }
@@ -251,7 +241,9 @@ ValidationError inspect(const char* path, DiscInfo& info) {
if (!knownDisc) { if (!knownDisc) {
return ValidationError::WrongGame; return ValidationError::WrongGame;
} }
info.isPal = knownDisc->region == Region::Europe;
info.platform = knownDisc->platform;
info.region = knownDisc->region;
if (!knownDisc->supported) { if (!knownDisc->supported) {
return ValidationError::WrongVersion; return ValidationError::WrongVersion;
} }
@@ -260,7 +252,7 @@ ValidationError inspect(const char* path, DiscInfo& info) {
bool isPal(const char* path) { bool isPal(const char* path) {
DiscInfo info{}; DiscInfo info{};
return inspect(path, info) == ValidationError::Success && info.isPal; return inspect(path, info) == ValidationError::Success && info.region == Region::Europe;
} }
void log_verification_state(std::string_view path, DiscVerificationState state) { void log_verification_state(std::string_view path, DiscVerificationState state) {
+14 -1
View File
@@ -17,6 +17,18 @@ enum class ValidationError : u8 {
Success Success
}; };
enum class Platform : u8 {
GameCube,
Wii,
};
enum class Region : u8 {
NorthAmerica,
Europe,
Japan,
Korea,
};
struct VerificationStatus { struct VerificationStatus {
std::atomic_size_t bytesRead = 0; std::atomic_size_t bytesRead = 0;
std::atomic_size_t bytesTotal = 0; std::atomic_size_t bytesTotal = 0;
@@ -25,7 +37,8 @@ struct VerificationStatus {
}; };
struct DiscInfo { struct DiscInfo {
bool isPal = false; Platform platform = Platform::GameCube;
Region region = Region::NorthAmerica;
}; };
ValidationError inspect(const char* path, DiscInfo& info); ValidationError inspect(const char* path, DiscInfo& info);
+1 -7
View File
@@ -10,7 +10,6 @@ UserSettings g_userSettings = {
.lockAspectRatio {"video.lockAspectRatio", false}, .lockAspectRatio {"video.lockAspectRatio", false},
.enableFpsOverlay {"game.enableFpsOverlay", false}, .enableFpsOverlay {"game.enableFpsOverlay", false},
.fpsOverlayCorner {"game.fpsOverlayCorner", 0}, .fpsOverlayCorner {"game.fpsOverlayCorner", 0},
.maxFrameRate {"video.maxFrameRate", 240},
}, },
.audio = { .audio = {
@@ -59,11 +58,9 @@ UserSettings g_userSettings = {
.bloomMode {"game.bloomMode", BloomMode::Dusk}, .bloomMode {"game.bloomMode", BloomMode::Dusk},
.bloomMultiplier {"game.bloomMultiplier", 1.0f}, .bloomMultiplier {"game.bloomMultiplier", 1.0f},
.disableWaterRefraction {"game.disableWaterRefraction", false}, .disableWaterRefraction {"game.disableWaterRefraction", false},
.enableTextureReplacements {"game.enableTextureReplacements", true}, .enableFrameInterpolation {"game.enableFrameInterpolation", false},
.enableFrameInterpolation {"game.enableFrameInterpolation", FrameInterpMode::Off},
.internalResolutionScale {"game.internalResolutionScale", 0}, .internalResolutionScale {"game.internalResolutionScale", 0},
.shadowResolutionMultiplier {"game.shadowResolutionMultiplier", 1}, .shadowResolutionMultiplier {"game.shadowResolutionMultiplier", 1},
.resampler {"game.resampler", Resampler::Bilinear},
.enableDepthOfField {"game.enableDepthOfField", true}, .enableDepthOfField {"game.enableDepthOfField", true},
.enableMapBackground {"game.enableMapBackground", true}, .enableMapBackground {"game.enableMapBackground", true},
.disableCutscenePillarboxing {"game.disableCutscenePillarboxing", false}, .disableCutscenePillarboxing {"game.disableCutscenePillarboxing", false},
@@ -180,7 +177,6 @@ void registerSettings() {
Register(g_userSettings.video.lockAspectRatio); Register(g_userSettings.video.lockAspectRatio);
Register(g_userSettings.video.enableFpsOverlay); Register(g_userSettings.video.enableFpsOverlay);
Register(g_userSettings.video.fpsOverlayCorner); Register(g_userSettings.video.fpsOverlayCorner);
Register(g_userSettings.video.maxFrameRate);
// Audio // Audio
Register(g_userSettings.audio.masterVolume); Register(g_userSettings.audio.masterVolume);
@@ -222,9 +218,7 @@ void registerSettings() {
Register(g_userSettings.game.bloomMode); Register(g_userSettings.game.bloomMode);
Register(g_userSettings.game.bloomMultiplier); Register(g_userSettings.game.bloomMultiplier);
Register(g_userSettings.game.disableWaterRefraction); Register(g_userSettings.game.disableWaterRefraction);
Register(g_userSettings.game.enableTextureReplacements);
Register(g_userSettings.game.internalResolutionScale); Register(g_userSettings.game.internalResolutionScale);
Register(g_userSettings.game.resampler);
Register(g_userSettings.game.shadowResolutionMultiplier); Register(g_userSettings.game.shadowResolutionMultiplier);
Register(g_userSettings.game.enableDepthOfField); Register(g_userSettings.game.enableDepthOfField);
Register(g_userSettings.game.enableMapBackground); Register(g_userSettings.game.enableMapBackground);
+48 -83
View File
@@ -37,7 +37,7 @@ Rml::String current_controller_name(int port) {
Rml::String controller_index_name(u32 index) { Rml::String controller_index_name(u32 index) {
const char* name = PADGetNameForControllerIndex(index); const char* name = PADGetNameForControllerIndex(index);
if (name == nullptr) { if (name == nullptr) {
return fmt::format("Device {}", index + 1); return fmt::format("Controller {}", index + 1);
} }
return name; return name;
} }
@@ -124,7 +124,7 @@ Rml::String native_axis_name(const PADAxisMapping& mapping, SDL_Gamepad* gamepad
return native_button_name(gamepad, static_cast<u32>(mapping.nativeButton)); return native_button_name(gamepad, static_cast<u32>(mapping.nativeButton));
} }
return "Not Bound"; return "Not bound";
} }
bool is_dpad_button(PADButton button) { bool is_dpad_button(PADButton button) {
@@ -162,7 +162,7 @@ bool keyboard_escape_pressed() {
Rml::String keyboard_key_name(s32 scancode) { Rml::String keyboard_key_name(s32 scancode) {
if (scancode == PAD_KEY_INVALID) { if (scancode == PAD_KEY_INVALID) {
return "Not Bound"; return "Not bound";
} }
switch (scancode) { switch (scancode) {
case PAD_KEY_MOUSE_LEFT: case PAD_KEY_MOUSE_LEFT:
@@ -303,7 +303,7 @@ void ControllerConfigWindow::build_port_tab(Rml::Element* content, int port) {
}); });
}; };
addPageButton(Page::Controller, "Device", [port] { return current_controller_name(port); }, [] { return false; }); addPageButton(Page::Controller, "Controller", [port] { return current_controller_name(port); }, [] { return false; });
addPageButton(Page::Buttons, "Buttons", [] { return Rml::String(">"); }, [] { return false; }); addPageButton(Page::Buttons, "Buttons", [] { return Rml::String(">"); }, [] { return false; });
addPageButton(Page::Triggers, "Triggers", [] { return Rml::String(">"); }, [] { return false; }); addPageButton(Page::Triggers, "Triggers", [] { return Rml::String(">"); }, [] { return false; });
addPageButton(Page::Sticks, "Sticks", [] { return Rml::String(">"); }, [] { return false; }); addPageButton(Page::Sticks, "Sticks", [] { return Rml::String(">"); }, [] { return false; });
@@ -349,14 +349,7 @@ void ControllerConfigWindow::build_port_tab(Rml::Element* content, int port) {
rightPane, [](Pane& pane) { rightPane, [](Pane& pane) {
pane.add_text("Treat analog trigger movement as digital L and R button input."); pane.add_text("Treat analog trigger movement as digital L and R button input.");
}); });
leftPane.register_control(leftPane.add_button("Restore Default Controls").on_pressed([this, port] {
mDoAud_seStartMenu(kSoundClick);
PADRestoreDefaultMapping(port);
}),
rightPane, [](Pane& pane) {
pane.clear();
pane.add_text("Restores all binding configurations for the currently selected device to their defaults.");
});
render_page(rightPane, port, mPage); render_page(rightPane, port, mPage);
} }
@@ -372,7 +365,7 @@ void ControllerConfigWindow::render_page(Pane& pane, int port, Page page) {
[port] { return PADGetIndexForPort(port) < 0 && !keyboard_active(port); }, [port] { return PADGetIndexForPort(port) < 0 && !keyboard_active(port); },
}) })
.on_pressed([this, port] { .on_pressed([this, port] {
mDoAud_seStartMenu(kSoundClick); mDoAud_seStartMenu(kSoundItemChange);
cancel_pending_binding(); cancel_pending_binding();
PADClearPort(port); PADClearPort(port);
PADSetKeyboardActive(static_cast<u32>(port), FALSE); PADSetKeyboardActive(static_cast<u32>(port), FALSE);
@@ -385,7 +378,7 @@ void ControllerConfigWindow::render_page(Pane& pane, int port, Page page) {
.isSelected = [port] { return keyboard_active(port); }, .isSelected = [port] { return keyboard_active(port); },
}) })
.on_pressed([this, port] { .on_pressed([this, port] {
mDoAud_seStartMenu(kSoundClick); mDoAud_seStartMenu(kSoundItemChange);
cancel_pending_binding(); cancel_pending_binding();
PADClearPort(port); PADClearPort(port);
PADSetKeyboardActive(static_cast<u32>(port), TRUE); PADSetKeyboardActive(static_cast<u32>(port), TRUE);
@@ -395,7 +388,7 @@ void ControllerConfigWindow::render_page(Pane& pane, int port, Page page) {
const u32 controllerCount = PADCount(); const u32 controllerCount = PADCount();
if (controllerCount == 0) { if (controllerCount == 0) {
pane.add_text("No Device Detected"); pane.add_text("No controllers detected");
break; break;
} }
@@ -407,7 +400,7 @@ void ControllerConfigWindow::render_page(Pane& pane, int port, Page page) {
[port, i] { return PADGetIndexForPort(port) == static_cast<s32>(i); }, [port, i] { return PADGetIndexForPort(port) == static_cast<s32>(i); },
}) })
.on_pressed([this, port, i] { .on_pressed([this, port, i] {
mDoAud_seStartMenu(kSoundClick); mDoAud_seStartMenu(kSoundItemChange);
cancel_pending_binding(); cancel_pending_binding();
PADSetKeyboardActive(static_cast<u32>(port), FALSE); PADSetKeyboardActive(static_cast<u32>(port), FALSE);
PADSetPortForIndex(i, port); PADSetPortForIndex(i, port);
@@ -432,18 +425,17 @@ void ControllerConfigWindow::render_page(Pane& pane, int port, Page page) {
PADKeyButtonBinding* bindings = PADKeyButtonBinding* bindings =
PADGetKeyButtonBindings(static_cast<u32>(port), &count); PADGetKeyButtonBindings(static_cast<u32>(port), &count);
if (bindings == nullptr) { if (bindings == nullptr) {
return Rml::String("Not Bound"); return Rml::String("Not bound");
} }
for (u32 i = 0; i < PAD_BUTTON_COUNT; ++i) { for (u32 i = 0; i < PAD_BUTTON_COUNT; ++i) {
if (bindings[i].padButton == button) { if (bindings[i].padButton == button) {
return keyboard_key_name(bindings[i].scancode); return keyboard_key_name(bindings[i].scancode);
} }
} }
return Rml::String("Not Bound"); return Rml::String("Not bound");
}, },
}) })
.on_pressed([this, port, button] { .on_pressed([this, port, button] {
mDoAud_seStartMenu(kSoundClick);
cancel_pending_binding(); cancel_pending_binding();
mPendingPort = port; mPendingPort = port;
mPendingBindingArmed = false; mPendingBindingArmed = false;
@@ -470,7 +462,7 @@ void ControllerConfigWindow::render_page(Pane& pane, int port, Page page) {
u32 buttonCount = 0; u32 buttonCount = 0;
PADButtonMapping* mappings = PADGetButtonMappings(port, &buttonCount); PADButtonMapping* mappings = PADGetButtonMappings(port, &buttonCount);
if (mappings == nullptr) { if (mappings == nullptr) {
pane.add_text("No Device Selected"); pane.add_text("No controller selected");
break; break;
} }
@@ -494,7 +486,6 @@ void ControllerConfigWindow::render_page(Pane& pane, int port, Page page) {
}, },
}) })
.on_pressed([this, port, &mapping] { .on_pressed([this, port, &mapping] {
mDoAud_seStartMenu(kSoundClick);
cancel_pending_binding(); cancel_pending_binding();
mPendingPort = port; mPendingPort = port;
mPendingBindingArmed = false; mPendingBindingArmed = false;
@@ -521,7 +512,6 @@ void ControllerConfigWindow::render_page(Pane& pane, int port, Page page) {
}, },
}) })
.on_pressed([this, port, &mapping] { .on_pressed([this, port, &mapping] {
mDoAud_seStartMenu(kSoundClick);
cancel_pending_binding(); cancel_pending_binding();
mPendingPort = port; mPendingPort = port;
mPendingBindingArmed = false; mPendingBindingArmed = false;
@@ -545,18 +535,17 @@ void ControllerConfigWindow::render_page(Pane& pane, int port, Page page) {
PADKeyButtonBinding* bindings = PADKeyButtonBinding* bindings =
PADGetKeyButtonBindings(static_cast<u32>(port), &count); PADGetKeyButtonBindings(static_cast<u32>(port), &count);
if (bindings == nullptr) { if (bindings == nullptr) {
return Rml::String("Not Bound"); return Rml::String("Not bound");
} }
for (u32 i = 0; i < PAD_BUTTON_COUNT; ++i) { for (u32 i = 0; i < PAD_BUTTON_COUNT; ++i) {
if (bindings[i].padButton == button) { if (bindings[i].padButton == button) {
return keyboard_key_name(bindings[i].scancode); return keyboard_key_name(bindings[i].scancode);
} }
} }
return Rml::String("Not Bound"); return Rml::String("Not bound");
}, },
}) })
.on_pressed([this, port, button] { .on_pressed([this, port, button] {
mDoAud_seStartMenu(kSoundClick);
cancel_pending_binding(); cancel_pending_binding();
mPendingPort = port; mPendingPort = port;
mPendingBindingArmed = false; mPendingBindingArmed = false;
@@ -577,18 +566,17 @@ void ControllerConfigWindow::render_page(Pane& pane, int port, Page page) {
PADKeyAxisBinding* bindings = PADKeyAxisBinding* bindings =
PADGetKeyAxisBindings(static_cast<u32>(port), &count); PADGetKeyAxisBindings(static_cast<u32>(port), &count);
if (bindings == nullptr) { if (bindings == nullptr) {
return Rml::String("Not Bound"); return Rml::String("Not bound");
} }
for (u32 i = 0; i < PAD_AXIS_COUNT; ++i) { for (u32 i = 0; i < PAD_AXIS_COUNT; ++i) {
if (bindings[i].padAxis == axis) { if (bindings[i].padAxis == axis) {
return keyboard_key_name(bindings[i].scancode); return keyboard_key_name(bindings[i].scancode);
} }
} }
return Rml::String("Not Bound"); return Rml::String("Not bound");
}, },
}) })
.on_pressed([this, port, axis] { .on_pressed([this, port, axis] {
mDoAud_seStartMenu(kSoundClick);
cancel_pending_binding(); cancel_pending_binding();
mPendingPort = port; mPendingPort = port;
mPendingBindingArmed = false; mPendingBindingArmed = false;
@@ -611,7 +599,7 @@ void ControllerConfigWindow::render_page(Pane& pane, int port, Page page) {
u32 buttonCount = 0; u32 buttonCount = 0;
PADButtonMapping* buttons = PADGetButtonMappings(port, &buttonCount); PADButtonMapping* buttons = PADGetButtonMappings(port, &buttonCount);
if (axes == nullptr && buttons == nullptr) { if (axes == nullptr && buttons == nullptr) {
pane.add_text("No Device Selected"); pane.add_text("No controller selected");
break; break;
} }
@@ -635,7 +623,6 @@ void ControllerConfigWindow::render_page(Pane& pane, int port, Page page) {
}, },
}) })
.on_pressed([this, port, &mapping] { .on_pressed([this, port, &mapping] {
mDoAud_seStartMenu(kSoundClick);
cancel_pending_binding(); cancel_pending_binding();
mPendingPort = port; mPendingPort = port;
mPendingBindingArmed = false; mPendingBindingArmed = false;
@@ -644,33 +631,30 @@ void ControllerConfigWindow::render_page(Pane& pane, int port, Page page) {
} }
} }
if (getSettings().backend.enableAdvancedSettings) { pane.add_section("Digital");
pane.add_section("Digital"); if (buttons != nullptr) {
if (buttons != nullptr) { for (u32 i = 0; i < buttonCount; ++i) {
for (u32 i = 0; i < buttonCount; ++i) { PADButtonMapping& mapping = buttons[i];
PADButtonMapping& mapping = buttons[i]; if (mapping.padButton != PAD_TRIGGER_L && mapping.padButton != PAD_TRIGGER_R) {
if (mapping.padButton != PAD_TRIGGER_L && mapping.padButton != PAD_TRIGGER_R) { continue;
continue;
}
pane.add_select_button({
.key = PADGetButtonName(mapping.padButton),
.getValue =
[this, &mapping, gamepad] {
if (mPendingButtonMapping == &mapping) {
return pending_button_label();
}
return native_button_name(
gamepad, mapping.nativeButton);
},
})
.on_pressed([this, port, &mapping] {
mDoAud_seStartMenu(kSoundClick);
cancel_pending_binding();
mPendingPort = port;
mPendingBindingArmed = false;
mPendingButtonMapping = &mapping;
});
} }
pane.add_select_button({
.key = PADGetButtonName(mapping.padButton),
.getValue =
[this, &mapping, gamepad] {
if (mPendingButtonMapping == &mapping) {
return pending_button_label();
}
return native_button_name(
gamepad, mapping.nativeButton);
},
})
.on_pressed([this, port, &mapping] {
cancel_pending_binding();
mPendingPort = port;
mPendingBindingArmed = false;
mPendingButtonMapping = &mapping;
});
} }
} }
@@ -722,18 +706,17 @@ void ControllerConfigWindow::render_page(Pane& pane, int port, Page page) {
PADKeyAxisBinding* bindings = PADKeyAxisBinding* bindings =
PADGetKeyAxisBindings(static_cast<u32>(port), &count); PADGetKeyAxisBindings(static_cast<u32>(port), &count);
if (bindings == nullptr) { if (bindings == nullptr) {
return Rml::String("Not Bound"); return Rml::String("Not bound");
} }
for (u32 i = 0; i < PAD_AXIS_COUNT; ++i) { for (u32 i = 0; i < PAD_AXIS_COUNT; ++i) {
if (bindings[i].padAxis == axis) { if (bindings[i].padAxis == axis) {
return keyboard_key_name(bindings[i].scancode); return keyboard_key_name(bindings[i].scancode);
} }
} }
return Rml::String("Not Bound"); return Rml::String("Not bound");
}, },
}) })
.on_pressed([this, port, axis] { .on_pressed([this, port, axis] {
mDoAud_seStartMenu(kSoundClick);
cancel_pending_binding(); cancel_pending_binding();
mPendingPort = port; mPendingPort = port;
mPendingBindingArmed = false; mPendingBindingArmed = false;
@@ -758,7 +741,7 @@ void ControllerConfigWindow::render_page(Pane& pane, int port, Page page) {
u32 axisCount = 0; u32 axisCount = 0;
PADAxisMapping* axes = PADGetAxisMappings(port, &axisCount); PADAxisMapping* axes = PADGetAxisMappings(port, &axisCount);
if (axes == nullptr) { if (axes == nullptr) {
pane.add_text("No Device Selected"); pane.add_text("No controller selected");
break; break;
} }
@@ -779,7 +762,6 @@ void ControllerConfigWindow::render_page(Pane& pane, int port, Page page) {
}, },
}) })
.on_pressed([this, port, &mapping] { .on_pressed([this, port, &mapping] {
mDoAud_seStartMenu(kSoundClick);
cancel_pending_binding(); cancel_pending_binding();
mPendingPort = port; mPendingPort = port;
mPendingBindingArmed = false; mPendingBindingArmed = false;
@@ -925,7 +907,6 @@ void ControllerConfigWindow::render_page(Pane& pane, int port, Page page) {
}, },
}) })
.on_pressed([this, port, actionBind] { .on_pressed([this, port, actionBind] {
mDoAud_seStartMenu(kSoundClick);
cancel_pending_binding(); cancel_pending_binding();
mPendingPort = port; mPendingPort = port;
mPendingBindingArmed = false; mPendingBindingArmed = false;
@@ -945,7 +926,7 @@ void ControllerConfigWindow::render_page(Pane& pane, int port, Page page) {
u32 buttonCount = 0; u32 buttonCount = 0;
PADButtonMapping* mappings = PADGetButtonMappings(port, &buttonCount); PADButtonMapping* mappings = PADGetButtonMappings(port, &buttonCount);
if (mappings == nullptr) { if (mappings == nullptr) {
pane.add_text("No Device Selected"); pane.add_text("No controller selected");
break; break;
} }
@@ -969,7 +950,6 @@ void ControllerConfigWindow::render_page(Pane& pane, int port, Page page) {
}, },
}) })
.on_pressed([this, port, actionBind] { .on_pressed([this, port, actionBind] {
mDoAud_seStartMenu(kSoundClick);
cancel_pending_binding(); cancel_pending_binding();
mPendingPort = port; mPendingPort = port;
mPendingBindingArmed = false; mPendingBindingArmed = false;
@@ -1033,12 +1013,6 @@ void ControllerConfigWindow::poll_pending_binding() {
const s32 nativeButton = PADGetNativeButtonPressed(mPendingPort); const s32 nativeButton = PADGetNativeButtonPressed(mPendingPort);
if (nativeButton != -1) { if (nativeButton != -1) {
const int completedPort = mPendingPort; const int completedPort = mPendingPort;
if (mPendingButtonMapping->nativeButton == static_cast<u32>(nativeButton) &&
(mPendingButtonMapping->padButton != PAD_BUTTON_A &&
mPendingButtonMapping->padButton != PAD_BUTTON_B)) {
unmap_pending_binding();
return;
}
mPendingButtonMapping->nativeButton = static_cast<u32>(nativeButton); mPendingButtonMapping->nativeButton = static_cast<u32>(nativeButton);
finish_pending_binding(completedPort); finish_pending_binding(completedPort);
} }
@@ -1049,10 +1023,6 @@ void ControllerConfigWindow::poll_pending_binding() {
const PADSignedNativeAxis nativeAxis = PADGetNativeAxisPulled(mPendingPort); const PADSignedNativeAxis nativeAxis = PADGetNativeAxisPulled(mPendingPort);
if (nativeAxis.nativeAxis != -1) { if (nativeAxis.nativeAxis != -1) {
const int completedPort = mPendingPort; const int completedPort = mPendingPort;
if (mPendingAxisMapping->nativeAxis.nativeAxis == nativeAxis.nativeAxis) {
unmap_pending_binding();
return;
}
mPendingAxisMapping->nativeAxis = nativeAxis; mPendingAxisMapping->nativeAxis = nativeAxis;
mPendingAxisMapping->nativeButton = -1; mPendingAxisMapping->nativeButton = -1;
finish_pending_binding(completedPort); finish_pending_binding(completedPort);
@@ -1079,10 +1049,6 @@ void ControllerConfigWindow::poll_pending_binding() {
if (button != -1) { if (button != -1) {
const int completedPort = mPendingPort; const int completedPort = mPendingPort;
if (mPendingActionBinding->getValue() == button) {
unmap_pending_binding();
return;
}
mPendingActionBinding->setValue(button); mPendingActionBinding->setValue(button);
config::Save(); config::Save();
finish_pending_binding(completedPort); finish_pending_binding(completedPort);
@@ -1092,7 +1058,6 @@ void ControllerConfigWindow::poll_pending_binding() {
} }
void ControllerConfigWindow::finish_pending_binding(int completedPort) { void ControllerConfigWindow::finish_pending_binding(int completedPort) {
mDoAud_seStartMenu(kSoundBindingChanged);
mPendingButtonMapping = nullptr; mPendingButtonMapping = nullptr;
mPendingAxisMapping = nullptr; mPendingAxisMapping = nullptr;
mPendingActionBinding = nullptr; mPendingActionBinding = nullptr;
@@ -1145,11 +1110,11 @@ bool ControllerConfigWindow::pending_input_neutral() const {
} }
Rml::String ControllerConfigWindow::pending_button_label() const { Rml::String ControllerConfigWindow::pending_button_label() const {
return mPendingBindingArmed ? "Press a Key or Button..." : "Waiting..."; return mPendingBindingArmed ? "Press a button..." : "Waiting...";
} }
Rml::String ControllerConfigWindow::pending_axis_label() const { Rml::String ControllerConfigWindow::pending_axis_label() const {
return mPendingBindingArmed ? "Move Axis or press a Key or Button..." : "Waiting..."; return mPendingBindingArmed ? "Move axis or press a button..." : "Waiting...";
} }
void ControllerConfigWindow::cancel_pending_binding() { void ControllerConfigWindow::cancel_pending_binding() {
@@ -1178,7 +1143,7 @@ void ControllerConfigWindow::finish_pending_key_binding() {
} }
Rml::String ControllerConfigWindow::pending_key_label() const { Rml::String ControllerConfigWindow::pending_key_label() const {
return mPendingBindingArmed ? "Press a Key or Mouse Button..." : "Waiting..."; return mPendingBindingArmed ? "Press a key or mouse button..." : "Waiting...";
} }
void ControllerConfigWindow::stop_rumble_test() { void ControllerConfigWindow::stop_rumble_test() {
@@ -1194,7 +1159,7 @@ void ControllerConfigWindow::stop_rumble_test() {
Rml::String native_button_name(SDL_Gamepad* gamepad, u32 buttonUntyped) { Rml::String native_button_name(SDL_Gamepad* gamepad, u32 buttonUntyped) {
if (buttonUntyped == PAD_NATIVE_BUTTON_INVALID) { if (buttonUntyped == PAD_NATIVE_BUTTON_INVALID) {
return "Not Bound"; return "Not bound";
} }
auto button = static_cast<SDL_GamepadButton>(buttonUntyped); auto button = static_cast<SDL_GamepadButton>(buttonUntyped);
+2 -2
View File
@@ -1501,14 +1501,14 @@ EditorWindow::EditorWindow() {
.getValue = .getValue =
[] { [] {
return std::popcount(static_cast<unsigned>( return std::popcount(static_cast<unsigned>(
get_player_status_b()->mTransformLevelFlag & 0xF)); get_player_status_b()->mTransformLevelFlag & 0x7));
}, },
.setValue = .setValue =
[](int value) { [](int value) {
get_player_status_b()->mTransformLevelFlag = get_player_status_b()->mTransformLevelFlag =
static_cast<u8>((1u << value) - 1u); static_cast<u8>((1u << value) - 1u);
}, },
.max = 4, .max = 3,
}), }),
rightPane, {}); rightPane, {});
leftPane.register_control( leftPane.register_control(
+1 -28
View File
@@ -3,7 +3,6 @@
#include "Z2AudioLib/Z2SeMgr.h" #include "Z2AudioLib/Z2SeMgr.h"
#include "m_Do/m_Do_audio.h" #include "m_Do/m_Do_audio.h"
#include <aurora/aurora.h>
#include <dolphin/gx/GXAurora.h> #include <dolphin/gx/GXAurora.h>
#include <dolphin/vi.h> #include <dolphin/vi.h>
#include <fmt/format.h> #include <fmt/format.h>
@@ -44,8 +43,6 @@ int get_value(GraphicsOption option) {
return getSettings().game.internalResolutionScale.getValue(); return getSettings().game.internalResolutionScale.getValue();
case GraphicsOption::ShadowResolution: case GraphicsOption::ShadowResolution:
return getSettings().game.shadowResolutionMultiplier.getValue(); return getSettings().game.shadowResolutionMultiplier.getValue();
case GraphicsOption::Resampler:
return static_cast<int>(getSettings().game.resampler.getValue());
case GraphicsOption::BloomMode: case GraphicsOption::BloomMode:
return static_cast<int>(getSettings().game.bloomMode.getValue()); return static_cast<int>(getSettings().game.bloomMode.getValue());
case GraphicsOption::BloomMultiplier: case GraphicsOption::BloomMultiplier:
@@ -65,22 +62,6 @@ void set_value(GraphicsOption option, int value) {
case GraphicsOption::ShadowResolution: case GraphicsOption::ShadowResolution:
getSettings().game.shadowResolutionMultiplier.setValue(value); getSettings().game.shadowResolutionMultiplier.setValue(value);
break; break;
case GraphicsOption::Resampler: {
const auto sampler = static_cast<Resampler>(std::clamp(value,
static_cast<int>(Resampler::Bilinear),
static_cast<int>(Resampler::Area)));
getSettings().game.resampler.setValue(sampler);
switch (sampler) {
case Resampler::Area:
aurora_set_resampler(SAMPLER_AREA);
break;
case Resampler::Bilinear:
default:
aurora_set_resampler(SAMPLER_BILINEAR);
break;
}
break;
}
case GraphicsOption::BloomMode: case GraphicsOption::BloomMode:
getSettings().game.bloomMode.setValue(static_cast<BloomMode>(std::clamp( getSettings().game.bloomMode.setValue(static_cast<BloomMode>(std::clamp(
value, static_cast<int>(BloomMode::Off), static_cast<int>(BloomMode::Dusk)))); value, static_cast<int>(BloomMode::Off), static_cast<int>(BloomMode::Dusk))));
@@ -196,14 +177,6 @@ Rml::String format_graphics_setting_value(GraphicsOption option, int value) {
} }
case GraphicsOption::ShadowResolution: case GraphicsOption::ShadowResolution:
return fmt::format("{}×", value); return fmt::format("{}×", value);
case GraphicsOption::Resampler:
switch (static_cast<Resampler>(value)) {
case Resampler::Bilinear:
return "Bilinear";
case Resampler::Area:
return "Area";
}
break;
case GraphicsOption::BloomMode: case GraphicsOption::BloomMode:
switch (static_cast<BloomMode>(value)) { switch (static_cast<BloomMode>(value)) {
case BloomMode::Off: case BloomMode::Off:
@@ -238,7 +211,7 @@ GraphicsTuner::GraphicsTuner(GraphicsTunerProps props, bool prelaunch)
SteppedCarousel::Props{ SteppedCarousel::Props{
.min = mValueMin, .min = mValueMin,
.max = mValueMax, .max = mValueMax,
.step = props.step, .step = 1,
.getValue = [this] { return get_value(mOption); }, .getValue = [this] { return get_value(mOption); },
.onChange = [this](int value) { set_value(mOption, value); }, .onChange = [this](int value) { set_value(mOption, value); },
.formatValue = .formatValue =
-2
View File
@@ -42,7 +42,6 @@ private:
enum class GraphicsOption { enum class GraphicsOption {
InternalResolution, InternalResolution,
ShadowResolution, ShadowResolution,
Resampler,
BloomMode, BloomMode,
BloomMultiplier, BloomMultiplier,
}; };
@@ -56,7 +55,6 @@ struct GraphicsTunerProps {
int valueMin = 0; int valueMin = 0;
int valueMax = 0; int valueMax = 0;
int defaultValue = 0; int defaultValue = 0;
int step = 1;
}; };
class GraphicsTuner : public Document { class GraphicsTuner : public Document {
+11 -20
View File
@@ -454,18 +454,10 @@ bool touch_moved_too_far(
return delta.SquaredMagnitude() > threshold * threshold; return delta.SquaredMagnitude() > threshold * threshold;
} }
void emit_key_press(Rml::Context& context, Rml::Input::KeyIdentifier key) noexcept {
context.ProcessMouseLeave();
context.ProcessKeyDown(key, 0);
}
void emit_key_tap(Rml::Context& context, Rml::Input::KeyIdentifier key) noexcept {
emit_key_press(context, key);
context.ProcessKeyUp(key, 0);
}
void dispatch_menu_key(Rml::Context& context) noexcept { void dispatch_menu_key(Rml::Context& context) noexcept {
emit_key_tap(context, Rml::Input::KI_F1); context.ProcessMouseLeave();
context.ProcessKeyDown(Rml::Input::KI_F1, 0);
context.ProcessKeyUp(Rml::Input::KI_F1, 0);
} }
bool handle_touch_menu_tap(Rml::Context& context, const SDL_Event& event) noexcept { bool handle_touch_menu_tap(Rml::Context& context, const SDL_Event& event) noexcept {
@@ -635,9 +627,7 @@ void process_axis_direction(
if (repeat->held) { if (repeat->held) {
if (released) { if (released) {
if (repeat->pending) { if (!repeat->pending) {
emit_key_tap(context, repeat->key);
} else {
context.ProcessKeyUp(repeat->key, 0); context.ProcessKeyUp(repeat->key, 0);
} }
set_pad_button_held(port, heldPadButton, false); set_pad_button_held(port, heldPadButton, false);
@@ -668,7 +658,8 @@ void process_axis_direction(
} }
begin_gamepad_key(*repeat, key); begin_gamepad_key(*repeat, key);
emit_key_press(context, key); context.ProcessMouseLeave();
context.ProcessKeyDown(key, 0);
} }
} // namespace } // namespace
@@ -756,7 +747,8 @@ void handle_event(const SDL_Event& event) noexcept {
} }
} }
if (!deferred) { if (!deferred) {
emit_key_press(*context, key); context->ProcessMouseLeave();
context->ProcessKeyDown(key, 0);
} }
} }
} else { } else {
@@ -768,9 +760,7 @@ void handle_event(const SDL_Event& event) noexcept {
if (repeat != nullptr) { if (repeat != nullptr) {
*repeat = {}; *repeat = {};
} }
if (wasPending) { if (!wasPending) {
emit_key_tap(*context, key);
} else {
context->ProcessKeyUp(key, 0); context->ProcessKeyUp(key, 0);
} }
} }
@@ -797,7 +787,8 @@ void update_input() noexcept {
repeat.pressedAt = now; repeat.pressedAt = now;
repeat.nextRepeatAt = repeat.nextRepeatAt =
repeat.repeatable ? now + kGamepadRepeatInitialDelay : 0.0; repeat.repeatable ? now + kGamepadRepeatInitialDelay : 0.0;
emit_key_press(*context, repeat.key); context->ProcessMouseLeave();
context->ProcessKeyDown(repeat.key, 0);
continue; continue;
} }
+2 -2
View File
@@ -103,13 +103,13 @@ Rml::Element* create_controller_warning(Rml::Element* parent) {
auto* heading = append(elem, "heading"); auto* heading = append(elem, "heading");
auto* title = append(heading, "span"); auto* title = append(heading, "span");
title->SetInnerRML("No Device Assigned"); title->SetInnerRML("No controller assigned");
auto* icon = append(heading, "icon"); auto* icon = append(heading, "icon");
icon->SetClass("warning", true); icon->SetClass("warning", true);
auto* message = append(elem, "message"); auto* message = append(elem, "message");
auto* content = append(message, "span"); auto* content = append(message, "span");
content->SetInnerRML("Configure <b>Port 1</b> in Settings."); content->SetInnerRML("Configure controller port 1 in Settings.");
return elem; return elem;
} }
+30 -2
View File
@@ -877,8 +877,36 @@ void Prelaunch::update() {
if (mDiscDetail != nullptr) { if (mDiscDetail != nullptr) {
if (activeDiscLoaded) { if (activeDiscLoaded) {
mDiscDetail->SetProperty(Rml::PropertyId::Display, Rml::Style::Display::Block); mDiscDetail->SetProperty(Rml::PropertyId::Display, Rml::Style::Display::Block);
Rml::String innerRML = "GameCube • "; Rml::String innerRML = "";
innerRML += state.activeDiscInfo.isPal ? "EUR" : "USA";
switch (state.activeDiscInfo.platform) {
case iso::Platform::GameCube:
innerRML += "GameCube";
break;
case iso::Platform::Wii:
innerRML += "Wii";
break;
}
innerRML += "";
switch (state.activeDiscInfo.region) {
case iso::Region::Japan:
innerRML += "JPN";
break;
case iso::Region::Europe:
innerRML += "EUR";
break;
case iso::Region::NorthAmerica:
innerRML += "USA";
break;
case iso::Region::Korea:
innerRML += "KOR";
break;
default:
innerRML += "Unknown";
break;
}
mDiscDetail->SetInnerRML(innerRML); mDiscDetail->SetInnerRML(innerRML);
} else { } else {
mDiscDetail->SetProperty(Rml::PropertyId::Display, Rml::Style::Display::None); mDiscDetail->SetProperty(Rml::PropertyId::Display, Rml::Style::Display::None);
+1 -1
View File
@@ -40,7 +40,7 @@ void applyPresetDusk() {
s.game.enableQuickTransform.setValue(true); s.game.enableQuickTransform.setValue(true);
s.game.instantSaves.setValue(true); s.game.instantSaves.setValue(true);
s.game.midnasLamentNonStop.setValue(true); s.game.midnasLamentNonStop.setValue(true);
s.game.enableFrameInterpolation.setValue(FrameInterpMode::Unlimited); s.game.enableFrameInterpolation.setValue(true);
s.game.sunsSong.setValue(true); s.game.sunsSong.setValue(true);
s.game.bloomMode.setValue(BloomMode::Dusk); s.game.bloomMode.setValue(BloomMode::Dusk);
s.game.internalResolutionScale.setValue(0); s.game.internalResolutionScale.setValue(0);
+13 -90
View File
@@ -59,12 +59,6 @@ constexpr std::array kFpsOverlayCornerNames = {
"Bottom Right", "Bottom Right",
}; };
constexpr std::array kInterpolationModes = {
"Off",
"Capped",
"Unlimited",
};
constexpr std::array kGyroInputModeLabels = { constexpr std::array kGyroInputModeLabels = {
"Sensor", "Sensor",
"Mouse", "Mouse",
@@ -163,8 +157,8 @@ std::vector<AuroraBackend> available_backends() {
size_t backendCount = 0; size_t backendCount = 0;
const AuroraBackend* raw = aurora_get_available_backends(&backendCount); const AuroraBackend* raw = aurora_get_available_backends(&backendCount);
for (size_t i = 0; i < backendCount; ++i) { for (size_t i = 0; i < backendCount; ++i) {
// Do not expose NULL // Do not expose NULL or D3D11
if (raw[i] != BACKEND_NULL) { if (raw[i] != BACKEND_NULL && raw[i] != BACKEND_D3D11) {
backends.emplace_back(raw[i]); backends.emplace_back(raw[i]);
} }
} }
@@ -357,15 +351,13 @@ const Rml::String kInternalResolutionHelpText =
const Rml::String kShadowResolutionHelpText = const Rml::String kShadowResolutionHelpText =
"Configure the shadow-map resolution. Higher values improve shadow quality but increase GPU " "Configure the shadow-map resolution. Higher values improve shadow quality but increase GPU "
"and memory usage."; "and memory usage.";
const Rml::String kResamplerHelpText =
"Configure the sampling method used when scaling the internal resolution for final presentation.";
const Rml::String kBloomHelpText = const Rml::String kBloomHelpText =
"Configure the post-processing bloom effect. Classic uses the original bloom pass; Dusklight uses " "Configure the post-processing bloom effect. Classic uses the original bloom pass; Dusklight uses "
"a higher-quality bloom pass."; "a higher-quality bloom pass.";
const Rml::String kBloomBrightnessHelpText = const Rml::String kBloomBrightnessHelpText =
"Configure bloom intensity. Higher values make bright areas glow more strongly."; "Configure bloom intensity. Higher values make bright areas glow more strongly.";
const Rml::String kUnlockFramerateHelpText = const Rml::String kUnlockFramerateHelpText =
"<br/>Uses inter-frame interpolation to enable higher frame rates.<br/><br/>May introduce minor " "Uses inter-frame interpolation to enable higher frame rates.<br/><br/>May introduce minor "
"visual artifacts or animation glitches."; "visual artifacts or animation glitches.";
int float_setting_percent(ConfigVar<float>& var) { int float_setting_percent(ConfigVar<float>& var) {
@@ -448,31 +440,6 @@ SelectButton& config_percent_select(Pane& leftPane, Pane& rightPane, ConfigVar<f
return button; return button;
} }
SelectButton& config_int_select(Pane& leftPane, Pane& rightPane, ConfigVar<int>& var,
Rml::String key, Rml::String helpText, int min, int max, int step = 5,
std::function<bool()> isDisabled = {}, std::string suffix = "") {
auto& button = leftPane.add_child<NumberButton>(NumberButton::Props{
.key = std::move(key),
.getValue = [&var] { return var; },
.setValue =
[&var, min, max](int value) {
var.setValue(std::clamp(value, min, max));
config::Save();
},
.isDisabled = std::move(isDisabled),
.isModified = [&var] { return var.getValue() != var.getDefaultValue(); },
.min = min,
.max = max,
.step = step,
.suffix = suffix,
});
leftPane.register_control(button, rightPane, [helpText = std::move(helpText)](Pane& pane) {
pane.clear();
pane.add_text(helpText);
});
return button;
}
template <typename T> template <typename T>
void graphics_tuner_control(Window& window, Pane& leftPane, Pane& rightPane, ConfigVar<T>& var, void graphics_tuner_control(Window& window, Pane& leftPane, Pane& rightPane, ConfigVar<T>& var,
const GraphicsTunerProps& props, bool prelaunch) { const GraphicsTunerProps& props, bool prelaunch) {
@@ -595,7 +562,7 @@ SettingsWindow::SettingsWindow(bool prelaunch) : mPrelaunch(prelaunch) {
.getValue = .getValue =
[] { [] {
const auto& state = prelaunch_state(); const auto& state = prelaunch_state();
if (!state.configuredDiscCanLaunch || !state.configuredDiscInfo.isPal) { if (!state.configuredDiscCanLaunch || state.configuredDiscInfo.region != iso::Region::Europe) {
return kLanguageNames[0]; return kLanguageNames[0];
} }
const u8 idx = static_cast<u8>(getSettings().game.language.getValue()); const u8 idx = static_cast<u8>(getSettings().game.language.getValue());
@@ -605,7 +572,7 @@ SettingsWindow::SettingsWindow(bool prelaunch) : mPrelaunch(prelaunch) {
[] { [] {
const auto& state = prelaunch_state(); const auto& state = prelaunch_state();
return !state.configuredDiscCanLaunch || return !state.configuredDiscCanLaunch ||
!state.configuredDiscInfo.isPal; state.configuredDiscInfo.region != iso::Region::Europe;
}, },
.isModified = .isModified =
[] { [] {
@@ -807,15 +774,6 @@ SettingsWindow::SettingsWindow(bool prelaunch) : mPrelaunch(prelaunch) {
.valueMax = 8, .valueMax = 8,
.defaultValue = 1, .defaultValue = 1,
}, mPrelaunch); }, mPrelaunch);
graphics_tuner_control(*this, leftPane, rightPane, getSettings().game.resampler,
GraphicsTunerProps{
.option = GraphicsOption::Resampler,
.title = "Output Resampling",
.helpText = kResamplerHelpText,
.valueMin = static_cast<int>(Resampler::Bilinear),
.valueMax = static_cast<int>(Resampler::Area),
.defaultValue = static_cast<int>(Resampler::Bilinear),
}, mPrelaunch);
leftPane.add_section("Post-Processing"); leftPane.add_section("Post-Processing");
graphics_tuner_control(*this, leftPane, rightPane, getSettings().game.bloomMode, graphics_tuner_control(*this, leftPane, rightPane, getSettings().game.bloomMode,
@@ -835,49 +793,14 @@ SettingsWindow::SettingsWindow(bool prelaunch) : mPrelaunch(prelaunch) {
.valueMin = 0, .valueMin = 0,
.valueMax = 100, .valueMax = 100,
.defaultValue = 100, .defaultValue = 100,
.step = 10,
}, mPrelaunch); }, mPrelaunch);
leftPane.add_section("Rendering"); leftPane.add_section("Rendering");
config_bool_select(leftPane, rightPane, getSettings().game.enableTextureReplacements, config_bool_select(leftPane, rightPane, getSettings().game.enableFrameInterpolation,
{ {
.key = "Use Texture Pack",
.helpText = "Enable installed texture replacements.",
.onChange = [](bool value) { aurora_set_texture_replacements_enabled(value); },
});
leftPane.register_control(
leftPane.add_select_button({
.key = "Unlock Framerate", .key = "Unlock Framerate",
.getValue = .helpText = kUnlockFramerateHelpText,
[] {
return kInterpolationModes[static_cast<u8>(getSettings().game.enableFrameInterpolation.getValue())];
},
.isModified =
[] {
return getSettings().game.enableFrameInterpolation.getValue() !=
getSettings().game.enableFrameInterpolation.getDefaultValue();
},
}),
rightPane, [](Pane& pane) {
for (int i = 0; i < kInterpolationModes.size(); i++) {
pane.add_button({
.text = kInterpolationModes[i],
.isSelected =
[i] {
return getSettings().game.enableFrameInterpolation.getValue() == static_cast<FrameInterpMode>(i);
},
})
.on_pressed([i] {
mDoAud_seStartMenu(kSoundItemChange);
getSettings().game.enableFrameInterpolation.setValue(static_cast<FrameInterpMode>(i));
config::Save();
});
}
pane.add_rml(kUnlockFramerateHelpText);
}); });
config_int_select(leftPane, rightPane, getSettings().video.maxFrameRate,
"Framerate Cap", "Limit the framerate to the specified value.", 30, 540, 1,
[] { return getSettings().game.enableFrameInterpolation.getValue() != FrameInterpMode::Capped; });
config_bool_select(leftPane, rightPane, getSettings().game.enableDepthOfField, config_bool_select(leftPane, rightPane, getSettings().game.enableDepthOfField,
{ {
.key = "Enable Depth of Field", .key = "Enable Depth of Field",
@@ -906,18 +829,18 @@ SettingsWindow::SettingsWindow(bool prelaunch) : mPrelaunch(prelaunch) {
}); });
}; };
leftPane.add_section("Inputs"); leftPane.add_section("Controller");
leftPane.register_control(leftPane.add_button("Configure Inputs").on_pressed([this] { leftPane.register_control(leftPane.add_button("Configure Controller").on_pressed([this] {
push(std::make_unique<ControllerConfigWindow>(mPrelaunch)); push(std::make_unique<ControllerConfigWindow>(mPrelaunch));
}), }),
rightPane, [](Pane& pane) { rightPane, [](Pane& pane) {
pane.clear(); pane.clear();
pane.add_text("Open input binding configuration."); pane.add_text("Open controller binding configuration.");
}); });
config_bool_select(leftPane, rightPane, getSettings().game.allowBackgroundInput, config_bool_select(leftPane, rightPane, getSettings().game.allowBackgroundInput,
{ {
.key = "Allow Background Inputs", .key = "Allow Background Input",
.helpText = "Allow inputs even when the game window is not focused.", .helpText = "Allow controller input even when the game window is not focused.",
.onChange = [](bool value) { aurora_set_background_input(value); }, .onChange = [](bool value) { aurora_set_background_input(value); },
}); });
@@ -1324,7 +1247,7 @@ SettingsWindow::SettingsWindow(bool prelaunch) : mPrelaunch(prelaunch) {
}); });
pane.add_button( pane.add_button(
{ {
.text = "Missing Device", .text = "Controller",
.isSelected = .isSelected =
[] { return getSettings().game.enableControllerToasts.getValue(); }, [] { return getSettings().game.enableControllerToasts.getValue(); },
}) })
+2 -2
View File
@@ -130,7 +130,7 @@ void handle_event(const SDL_Event& event) noexcept {
if (getSettings().game.enableControllerToasts) { if (getSettings().game.enableControllerToasts) {
const char* name = SDL_GetGamepadName(gamepad); const char* name = SDL_GetGamepadName(gamepad);
Rml::String content = fmt::format("<span>{}</span>", name ? name : "[Unknown]"); Rml::String content = fmt::format("<span>{}</span>", name ? name : "[Unknown]");
Rml::String title = "Device Connected"; Rml::String title = "Controller connected";
if (const char* icon = connection_state_icon(SDL_GetGamepadConnectionState(gamepad))) { if (const char* icon = connection_state_icon(SDL_GetGamepadConnectionState(gamepad))) {
title = fmt::format( title = fmt::format(
"<row><span>{}</span> <icon class=\"connection\">&#x{};</icon></row>", title, "<row><span>{}</span> <icon class=\"connection\">&#x{};</icon></row>", title,
@@ -163,7 +163,7 @@ void handle_event(const SDL_Event& event) noexcept {
const char* name = SDL_GetGamepadNameForID(event.gdevice.which); const char* name = SDL_GetGamepadNameForID(event.gdevice.which);
push_toast({ push_toast({
.type = "controller", .type = "controller",
.title = "Device Disconnected", .title = "Controller disconnected",
.content = name ? name : "[Unknown]", .content = name ? name : "[Unknown]",
.duration = std::chrono::seconds(4), .duration = std::chrono::seconds(4),
}); });
-4
View File
@@ -26,8 +26,6 @@ struct Toast {
constexpr u32 kSoundClick = Z2SE_SY_CURSOR_OK; constexpr u32 kSoundClick = Z2SE_SY_CURSOR_OK;
// "Play" button clicked/pressed // "Play" button clicked/pressed
constexpr u32 kSoundPlay = Z2SE_SY_ITEM_COMBINE_ON; constexpr u32 kSoundPlay = Z2SE_SY_ITEM_COMBINE_ON;
// Input binding changed
constexpr u32 kSoundBindingChanged = Z2SE_SY_ITEM_SET_X;
// Menu button pressed (open/close menu bar or hide/show the active window) // Menu button pressed (open/close menu bar or hide/show the active window)
constexpr u32 kSoundMenuOpen = Z2SE_SY_MENU_SUB_IN; constexpr u32 kSoundMenuOpen = Z2SE_SY_MENU_SUB_IN;
@@ -51,8 +49,6 @@ constexpr u32 kSoundItemDisable = Z2SE_SUBJ_VIEW_OUT;
// Achievement unlocked // Achievement unlocked
constexpr u32 kSoundAchievementUnlock = Z2SE_NAVI_FLY; constexpr u32 kSoundAchievementUnlock = Z2SE_NAVI_FLY;
// Warning prompt
constexpr u32 kSoundWarning = Z2SE_SY_COW_GET_IN;
struct Insets { struct Insets {
float top = 0.0f; float top = 0.0f;
+2
View File
@@ -28,6 +28,8 @@ void init() {
gameVersion = GameVersion::GcnUsa; gameVersion = GameVersion::GcnUsa;
} else if (game == "GZ2P") { } else if (game == "GZ2P") {
gameVersion = GameVersion::GcnPal; gameVersion = GameVersion::GcnPal;
} else if (game == "GZ2J") {
gameVersion = GameVersion::GcnJpn;
} else { } else {
// TODO: Handle remaining valid versions. // TODO: Handle remaining valid versions.
DuskLog.fatal("Unknown/unsupported game version in disc: {}", game); DuskLog.fatal("Unknown/unsupported game version in disc: {}", game);
+23 -8
View File
@@ -26,6 +26,7 @@
#include <cstring> #include <cstring>
#include "dusk/logging.h" #include "dusk/logging.h"
#include "dusk/frame_interpolation.h" #include "dusk/frame_interpolation.h"
#include "dusk/version.hpp"
u8 mDoExt::CurrentHeapAdjustVerbose; u8 mDoExt::CurrentHeapAdjustVerbose;
u8 mDoExt::HeapAdjustVerbose; u8 mDoExt::HeapAdjustVerbose;
@@ -2410,7 +2411,7 @@ void mDoExt_3DlineMat0_c::draw() {
} }
#if TARGET_PC #if TARGET_PC
if (!dusk::frame_interp::is_enabled()) if (!dusk::getSettings().game.enableFrameInterpolation)
#endif #endif
{ {
field_0x16 ^= (u8)1; field_0x16 ^= (u8)1;
@@ -2740,7 +2741,7 @@ void mDoExt_3DlineMat1_c::draw() {
} }
GXSetTexCoordScaleManually(GX_TEXCOORD0, 0, 0, 0); GXSetTexCoordScaleManually(GX_TEXCOORD0, 0, 0, 0);
#if TARGET_PC #if TARGET_PC
if (!dusk::frame_interp::is_enabled()) if (!dusk::getSettings().game.enableFrameInterpolation)
#endif #endif
{ {
mIsDrawn ^= (u8)1; mIsDrawn ^= (u8)1;
@@ -2822,7 +2823,7 @@ void mDoExt_3DlineMat1_c::update(int param_0, f32 param_1, GXColor& param_2, u16
} }
#if TARGET_PC #if TARGET_PC
const cXyz& lineEye = (presentationEye != nullptr && dusk::frame_interp::is_enabled()) ? *presentationEye : sp_3c->lookat.eye; const cXyz& lineEye = (presentationEye != nullptr && dusk::getSettings().game.enableFrameInterpolation) ? *presentationEye : sp_3c->lookat.eye;
sp_13c = *local_r27 - lineEye; sp_13c = *local_r27 - lineEye;
#else #else
sp_13c = *local_r27 - sp_3c->lookat.eye; sp_13c = *local_r27 - sp_3c->lookat.eye;
@@ -2982,7 +2983,7 @@ void mDoExt_3DlineMat1_c::update(int param_0, GXColor& param_2, dKy_tevstr_c* pa
local_r27 = sp_38[0].field_0x0; local_r27 = sp_38[0].field_0x0;
size_p = sp_38->field_0x4; size_p = sp_38->field_0x4;
#if TARGET_PC #if TARGET_PC
if (presentationEye != nullptr && dusk::frame_interp::is_enabled() && size_p == NULL) { if (presentationEye != nullptr && dusk::getSettings().game.enableFrameInterpolation && size_p == NULL) {
sp_38 += 1; sp_38 += 1;
continue; continue;
} }
@@ -3001,7 +3002,7 @@ void mDoExt_3DlineMat1_c::update(int param_0, GXColor& param_2, dKy_tevstr_c* pa
local_f30 = sp_130.abs(); local_f30 = sp_130.abs();
local_f31 += local_f30 * 0.1f; local_f31 += local_f30 * 0.1f;
#if TARGET_PC #if TARGET_PC
const cXyz& lineEye = (presentationEye != nullptr && dusk::frame_interp::is_enabled()) ? *presentationEye : stack_3c->lookat.eye; const cXyz& lineEye = (presentationEye != nullptr && dusk::getSettings().game.enableFrameInterpolation) ? *presentationEye : stack_3c->lookat.eye;
sp_13c = local_r27[0] - lineEye; sp_13c = local_r27[0] - lineEye;
#else #else
sp_13c = local_r27[0] - stack_3c->lookat.eye; sp_13c = local_r27[0] - stack_3c->lookat.eye;
@@ -3077,7 +3078,7 @@ void mDoExt_3DlineMat1_c::update(int param_0, GXColor& param_2, dKy_tevstr_c* pa
#if TARGET_PC #if TARGET_PC
void mDoExt_3DlineMat1_c::refreshGeometryForPresentationEye(const cXyz& eye) { void mDoExt_3DlineMat1_c::refreshGeometryForPresentationEye(const cXyz& eye) {
if (!dusk::frame_interp::is_enabled()) { if (!dusk::getSettings().game.enableFrameInterpolation) {
return; return;
} }
if (mInterpLineKind == 1) { if (mInterpLineKind == 1) {
@@ -3701,7 +3702,15 @@ static ResFONT* mDoExt_resfont0;
static void mDoExt_initFont0() { static void mDoExt_initFont0() {
static char const fontdata[] = "rodan_b_24_22.bfn"; static char const fontdata[] = "rodan_b_24_22.bfn";
#if REGION_JPN #if TARGET_PC
if (dusk::version::getGameVersion() == dusk::version::GameVersion::GcnJpn) {
mDoExt_initFontCommon(&mDoExt_font0, &mDoExt_resfont0, mDoExt_getZeldaHeap(),
fontdata, dComIfGp_getFontArchive(), 0, 200, 512);
} else {
mDoExt_initFontCommon(&mDoExt_font0, &mDoExt_resfont0, mDoExt_getZeldaHeap(),
fontdata, dComIfGp_getFontArchive(), 1, 0, 0);
}
#elif REGION_JPN
mDoExt_initFontCommon(&mDoExt_font0, &mDoExt_resfont0, mDoExt_getZeldaHeap(), mDoExt_initFontCommon(&mDoExt_font0, &mDoExt_resfont0, mDoExt_getZeldaHeap(),
fontdata, dComIfGp_getFontArchive(), 0, 200, 512); fontdata, dComIfGp_getFontArchive(), 0, 200, 512);
#else #else
@@ -3728,7 +3737,13 @@ void mDoExt_removeMesgFont() {
JKR_DELETE(mDoExt_font0); JKR_DELETE(mDoExt_font0);
mDoExt_font0 = NULL; mDoExt_font0 = NULL;
if (mDoExt_resfont0 != NULL) { if (mDoExt_resfont0 != NULL) {
#if REGION_JPN #if TARGET_PC
if (dusk::version::getGameVersion() == dusk::version::GameVersion::GcnJpn) {
JKRFileLoader::removeResource(mDoExt_resfont0, NULL);
} else {
JKRFree(mDoExt_resfont0);
}
#elif REGION_JPN
JKRFileLoader::removeResource(mDoExt_resfont0, NULL); JKRFileLoader::removeResource(mDoExt_resfont0, NULL);
#else #else
JKRFree(mDoExt_resfont0); JKRFree(mDoExt_resfont0);
+3 -3
View File
@@ -2063,7 +2063,7 @@ static void captureScreenPerspDrawInfo(JPADrawInfo& info) {
static void drawItem3D() { static void drawItem3D() {
ZoneScoped; ZoneScoped;
#ifdef TARGET_PC #ifdef TARGET_PC
if (dusk::frame_interp::is_enabled()) { if (dusk::getSettings().game.enableFrameInterpolation) {
// FRAME INTERP NOTE: Title screen needs 0.0f while everything else that runs through this is -100.0f. // FRAME INTERP NOTE: Title screen needs 0.0f while everything else that runs through this is -100.0f.
if (fopAcM_SearchByName(fpcNm_TITLE_e) != nullptr) { if (fopAcM_SearchByName(fpcNm_TITLE_e) != nullptr) {
dMenu_Collect3D_c::setViewPortOffsetY(0.0f); dMenu_Collect3D_c::setViewPortOffsetY(0.0f);
@@ -2241,7 +2241,7 @@ int mDoGph_Painter() {
#endif #endif
dKy_setLight(); dKy_setLight();
#if TARGET_PC #if TARGET_PC
if (dusk::frame_interp::is_enabled()) { if (dusk::getSettings().game.enableFrameInterpolation) {
dKy_setLight_again(); dKy_setLight_again();
} }
#endif #endif
@@ -2296,7 +2296,7 @@ int mDoGph_Painter() {
} }
#if TARGET_PC #if TARGET_PC
if (dusk::frame_interp::is_enabled()) { if (dusk::getSettings().game.enableFrameInterpolation) {
// FRAME INTERP NOTE: Currently only recalculating points for Epona's reins. Need a more global solution. // FRAME INTERP NOTE: Currently only recalculating points for Epona's reins. Need a more global solution.
if (daHorse_c* horse = dComIfGp_getHorseActor()) { if (daHorse_c* horse = dComIfGp_getHorseActor()) {
horse->lerpControlPoints(dusk::frame_interp::get_interpolation_step()); horse->lerpControlPoints(dusk::frame_interp::get_interpolation_step());
+5 -34
View File
@@ -28,7 +28,6 @@
#include "d/d_s_logo.h" #include "d/d_s_logo.h"
#include "d/d_s_menu.h" #include "d/d_s_menu.h"
#include "d/d_s_play.h" #include "d/d_s_play.h"
#include "dusk/time.h"
#include "f_ap/f_ap_game.h" #include "f_ap/f_ap_game.h"
#include "f_op/f_op_msg.h" #include "f_op/f_op_msg.h"
#include "m_Do/m_Do_MemCard.h" #include "m_Do/m_Do_MemCard.h"
@@ -280,9 +279,8 @@ void main01(void) {
const auto pacing = dusk::game_clock::advance_main_loop(); const auto pacing = dusk::game_clock::advance_main_loop();
if (pacing.is_interpolating) { if (pacing.is_interpolating) {
if (pacing.sim_ticks_to_run > 0) { if (pacing.sim_ticks_to_run > 0) {
dusk::frame_interp::begin_frame(dusk::getSettings().game.enableFrameInterpolation, true, 0.0f); dusk::frame_interp::begin_frame(true, true, 0.0f);
dusk::frame_interp::set_ui_tick_pending(true); dusk::frame_interp::set_ui_tick_pending(true);
for (int sim_tick = 0; sim_tick < pacing.sim_ticks_to_run; ++sim_tick) { for (int sim_tick = 0; sim_tick < pacing.sim_ticks_to_run; ++sim_tick) {
dusk::frame_interp::begin_sim_tick(); dusk::frame_interp::begin_sim_tick();
mDoCPd_c::read(); mDoCPd_c::read();
@@ -293,7 +291,7 @@ void main01(void) {
} }
} }
dusk::frame_interp::begin_frame(dusk::getSettings().game.enableFrameInterpolation, false, dusk::frame_interp::begin_frame(true, false,
dusk::game_clock::sample_interpolation_step()); dusk::game_clock::sample_interpolation_step());
dusk::frame_interp::interpolate(); dusk::frame_interp::interpolate();
dusk::frame_interp::begin_presentation_camera(); dusk::frame_interp::begin_presentation_camera();
@@ -303,7 +301,7 @@ void main01(void) {
dusk::frame_interp::end_presentation_camera(); dusk::frame_interp::end_presentation_camera();
dusk::frame_interp::set_ui_tick_pending(false); dusk::frame_interp::set_ui_tick_pending(false);
} else { } else {
dusk::frame_interp::begin_frame(dusk::FrameInterpMode::Off, true, 0.0f); dusk::frame_interp::begin_frame(false, true, 0.0f);
dusk::frame_interp::set_ui_tick_pending(true); dusk::frame_interp::set_ui_tick_pending(true);
// Game Inputs // Game Inputs
@@ -317,26 +315,8 @@ void main01(void) {
mDoAud_Execute(); mDoAud_Execute();
} }
static Limiter main_loop_limiter;
static double last_fps_setting = 0.0;
static Limiter::duration_t target_ns = 0;
if (dusk::getSettings().game.enableFrameInterpolation.getValue() == dusk::FrameInterpMode::Capped && !dusk::getTransientSettings().skipFrameRateLimit) {
double current_fps = dusk::getSettings().video.maxFrameRate.getValue();
if (current_fps != last_fps_setting) {
last_fps_setting = current_fps;
target_ns = static_cast<Limiter::duration_t>(1'000'000'000.0 / current_fps);
}
Limiter::duration_t sleepTime = main_loop_limiter.Sleep(target_ns);
dusk::frameUsagePct = 100.0f * (1.0f - static_cast<float>(sleepTime) / static_cast<float>(target_ns));
} else {
main_loop_limiter.Reset();
}
aurora_end_frame(); aurora_end_frame();
FrameMark; FrameMark;
#ifdef DUSK_DISCORD #ifdef DUSK_DISCORD
@@ -513,7 +493,7 @@ int game_main(int argc, char* argv[]) {
("h,help", "Print usage") ("h,help", "Print usage")
("console", "Show the Windows console window for logs", cxxopts::value<bool>()->default_value("false")->implicit_value("true")) ("console", "Show the Windows console window for logs", cxxopts::value<bool>()->default_value("false")->implicit_value("true"))
("dvd", "Path to DVD image file", cxxopts::value<std::string>()) ("dvd", "Path to DVD image file", cxxopts::value<std::string>())
("backend", "Graphics API backend to use (auto, d3d12, d3d11, metal, vulkan, null)", cxxopts::value<std::string>()) ("backend", "Graphics API backend to use (auto, d3d12, metal, vulkan, null)", cxxopts::value<std::string>())
("cvar", "Override configuration variables without modifying config", cxxopts::value<std::vector<std::string>>()); ("cvar", "Override configuration variables without modifying config", cxxopts::value<std::vector<std::string>>());
arg_options.parse_positional({"dvd"}); arg_options.parse_positional({"dvd"});
@@ -583,7 +563,7 @@ int game_main(int argc, char* argv[]) {
config.allowJoystickBackgroundEvents = dusk::getSettings().game.allowBackgroundInput; config.allowJoystickBackgroundEvents = dusk::getSettings().game.allowBackgroundInput;
config.pauseOnFocusLost = dusk::getSettings().game.pauseOnFocusLost; config.pauseOnFocusLost = dusk::getSettings().game.pauseOnFocusLost;
config.imGuiInitCallback = &aurora_imgui_init_callback; config.imGuiInitCallback = &aurora_imgui_init_callback;
config.allowTextureReplacements = dusk::getSettings().game.enableTextureReplacements; config.allowTextureReplacements = true;
config.allowTextureDumps = false; config.allowTextureDumps = false;
auroraInfo = aurora_initialize(argc, argv, &config); auroraInfo = aurora_initialize(argc, argv, &config);
} }
@@ -604,15 +584,6 @@ int game_main(int argc, char* argv[]) {
AuroraSetViewportPolicy(AURORA_VIEWPORT_STRETCH); AuroraSetViewportPolicy(AURORA_VIEWPORT_STRETCH);
} }
VISetFrameBufferScale(dusk::getSettings().game.internalResolutionScale.getValue()); VISetFrameBufferScale(dusk::getSettings().game.internalResolutionScale.getValue());
switch (dusk::getSettings().game.resampler.getValue()) {
case dusk::Resampler::Area:
aurora_set_resampler(SAMPLER_AREA);
break;
case dusk::Resampler::Bilinear:
default:
aurora_set_resampler(SAMPLER_BILINEAR);
break;
}
dusk::audio::SetMasterVolume(dusk::audio::MasterVolumeToLinear(dusk::getSettings().audio.masterVolume / 100.0f)); dusk::audio::SetMasterVolume(dusk::audio::MasterVolumeToLinear(dusk::getSettings().audio.masterVolume / 100.0f));
dusk::audio::SetEnableReverb(dusk::getSettings().audio.enableReverb); dusk::audio::SetEnableReverb(dusk::getSettings().audio.enableReverb);