Skip to content

Commit

Permalink
Fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
inada-s committed Jan 1, 2025
1 parent 793debb commit 301eb9a
Show file tree
Hide file tree
Showing 22 changed files with 45 additions and 76 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1424,6 +1424,8 @@ if(NOT LIBRETRO)
core/ui/gui_util.h
core/ui/mainui.cpp
core/ui/mainui.h
core/ui/sleep.cpp
core/ui/sleep.h
core/ui/boxart/boxart.cpp
core/ui/boxart/boxart.h
core/ui/boxart/gamesdb.cpp
Expand Down
1 change: 1 addition & 0 deletions core/cfg/option.h
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,7 @@ extern Option<bool> EmulateFramebuffer;
extern Option<int> FixedFrequency;
extern Option<bool> FixUpscaleBleedingEdge;
extern Option<bool> CustomGpuDriver;
#ifdef VIDEO_ROUTING
extern Option<bool, false> VideoRouting;
extern Option<bool, false> VideoRoutingScale;
extern Option<int, false> VideoRoutingVRes;
Expand Down
2 changes: 1 addition & 1 deletion core/emulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ void Emulator::init()
else
#endif
INFO_LOG(INTERPRETER, "Using Interpreter");
}

gdxsv_emu_reset();
interpreter = Get_Sh4Interpreter();
interpreter->Init();
Expand Down
3 changes: 2 additions & 1 deletion core/emulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ enum class Event {
VBlank,
Network,
DiskChange,
max = DiskChange
GGPOGameEnd,
max = GGPOGameEnd
};

class EventManager
Expand Down
8 changes: 4 additions & 4 deletions core/gdxsv/gdxsv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
#include "network/ggpo.h"
#include "oslib/oslib.h"
#include "reios/reios.h"
#include "rend/boxart/http_client.h"
#include "rend/gui.h"
#include "oslib/http_client.h"
#include "ui/gui.h"
#include "version.h"

bool encode_zlib_deflate(const char *data, int len, std::vector<u8> &out) {
Expand Down Expand Up @@ -634,15 +634,15 @@ void Gdxsv::RestoreOnlinePatch() {
patch_list_.clear_patches();

// Discard dynarec cache because it may become corrupted
sh4_cpu.ResetCache();
emu.getSh4Executor()->ResetCache();
}

void Gdxsv::WritePatch() {
if (disk_ == 1) WritePatchDisk1();
if (disk_ == 2) WritePatchDisk2();
if (symbols_["patch_id"] == 0 || gdxsv_ReadMem32(symbols_["patch_id"]) != symbols_[":patch_id"]) {
NOTICE_LOG(COMMON, "patch %d %d", gdxsv_ReadMem32(symbols_["patch_id"]), symbols_[":patch_id"]);
sh4_cpu.ResetCache();
emu.getSh4Executor()->ResetCache();

#include "gdxsv_patch.inc"

Expand Down
27 changes: 14 additions & 13 deletions core/gdxsv/gdxsv_backend_replay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#include "gdxsv_replay_util.h"
#include "input/gamepad_device.h"
#include "libs.h"
#include "rend/gui.h"
#include "rend/gui_util.h"
#include "ui/gui.h"
#include "ui/gui_util.h"
#include "sdl/sdl.h"

using namespace std::chrono;
Expand Down Expand Up @@ -149,7 +149,7 @@ void GdxsvBackendReplay::OnMainUiLoop() {

void GdxsvBackendReplay::OnEndOfFrame() {
end_of_frame_ = true;
sh4_cpu.Stop();
emu.getSh4Executor()->Stop();
}

void GdxsvBackendReplay::OnNextFrame() {
Expand Down Expand Up @@ -226,23 +226,23 @@ void GdxsvBackendReplay::OnNextFrame() {
if (state_ == State::McsInBattle) {
ctrl_pause_ = !ctrl_pause_;
if (ctrl_pause_)
gui_display_notification("Paused", duration);
os_notify("Paused", duration);
else
gui_display_notification("Resumed", duration);
os_notify("Resumed", duration);
}
ctrl_commands_.pop_front();
}

if (ctrl.cmd == ReplayCtrlCommand::StepFrame) {
if (ctrl_pause_) {
ctrl_step_frame_ = true;
gui_display_notification(("StepFrame:" + std::to_string(key_msg_count_)).c_str(), duration);
os_notify(("StepFrame:" + std::to_string(key_msg_count_)).c_str(), duration);
}
ctrl_commands_.pop_front();
}

if (ctrl.cmd == ReplayCtrlCommand::SeekForward) {
gui_display_notification(">>", duration);
os_notify(">>", duration);
const int skip_frames = 1 <= ctrl.arg1 ? ctrl.arg1 : save_interval;
int skipped_frame;
auto t0 = high_resolution_clock::now();
Expand All @@ -269,7 +269,7 @@ void GdxsvBackendReplay::OnNextFrame() {
(float)ms / skipped_frame, prev_key_msg_count, key_msg_count_, key_msg_count_ - prev_key_msg_count);
char buf[256];
snprintf(buf, sizeof(buf), "Skipped %d frames %.2f[ms/fr]", skipped_frame, (float)ms / skipped_frame);
gui_display_notification(buf, duration);
os_notify(buf, duration);
}
ctrl_commands_.pop_front();
}
Expand Down Expand Up @@ -301,7 +301,7 @@ void GdxsvBackendReplay::OnNextFrame() {
NOTICE_LOG(COMMON, "SeekToBriefing skipped %d[fr] in %ld[ms] (%.2f[ms/fr])", skipped_frame, ms, (float)ms / skipped_frame);
char buf[256];
snprintf(buf, sizeof(buf), "Skipped %d frames %.2f[ms/fr]", skipped_frame, (float)ms / skipped_frame);
gui_display_notification(buf, duration);
os_notify(buf, duration);
}

ctrl_play_speed_ = org_speed;
Expand All @@ -318,9 +318,9 @@ void GdxsvBackendReplay::OnNextFrame() {
recv_buf_.clear();
gdxsv.key_display_.Clear();
if (!in_game()) {
KillTex = true;
EventManager::event(Event::GGPOGameEnd);
}
gui_display_notification("<<", duration);
os_notify("<<", duration);
}
}
ctrl_commands_.pop_front();
Expand All @@ -337,7 +337,7 @@ void GdxsvBackendReplay::OnNextFrame() {
if (ctrl_play_speed_ == 2) speed_text = "Speed:300%";
if (ctrl_play_speed_ == -1) speed_text = "Speed:50%";
if (ctrl_play_speed_ == -2) speed_text = "Speed:33%";
gui_display_notification(speed_text.c_str(), duration);
os_notify(speed_text.c_str(), duration);
}
ctrl_commands_.pop_front();
}
Expand All @@ -347,7 +347,6 @@ void GdxsvBackendReplay::OnNextFrame() {
if (0 < round && round != start_msg_count_ && round - 1 < log_file_.start_msg_indexes_size() &&
round - 1 < log_file_.start_msg_randoms_size() && gdxsv_save_state.FirstSavedFrame() != -1) {
gdxsv_save_state.LoadState(gdxsv_save_state.FirstSavedFrame());
KillTex = true;
key_msg_count_ = log_file_.start_msg_indexes(round - 1);
start_msg_count_ = round;
const int k_rnd0 = gdxsv.Disk() == 1 ? 0x0c310800 : 0x0c3abf40;
Expand All @@ -367,6 +366,8 @@ void GdxsvBackendReplay::OnNextFrame() {
ctrl_commands_.emplace_back(ReplayCtrlCommand::SaveFirstFrame);
ctrl_commands_.emplace_back(ReplayCtrlCommand::SendStartMsg);
ctrl_commands_.emplace_back(ReplayCtrlCommand::SeekToBriefing);

EventManager::event(Event::GGPOGameEnd);
}

ctrl_commands_.pop_front();
Expand Down
4 changes: 2 additions & 2 deletions core/gdxsv/gdxsv_backend_rollback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "log/InMemoryListener.h"
#include "network/ggpo.h"
#include "network/net_platform.h"
#include "rend/boxart/http_client.h"
#include "oslib/http_client.h"
#include "rend/gui_util.h"
#include "rend/transform_matrix.h"

Expand Down Expand Up @@ -414,12 +414,12 @@ void GdxsvBackendRollback::Close() {
config::LimitFPS.load();
config::AudioBufferSize.load();
RestorePatch();
KillTex = true;
osd_network_stat_ = false;
error_fast_return_ = false;
SaveReplay();
gdxsv.key_display_.enabled(false);
state_ = State::Closed;
EventManager::event(Event::GGPOGameEnd);
NOTICE_LOG(COMMON, "GdxsvBackendRollback.Close Done");
}

Expand Down
4 changes: 2 additions & 2 deletions core/gdxsv/gdxsv_backend_udp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "gdxsv.h"
#include "libs.h"
#include "rend/gui.h"
#include "ui/gui.h"

void GdxsvBackendUdp::Reset() {
CloseMcsRemoteWithReason("cl_hard_reset");
Expand Down Expand Up @@ -174,7 +174,7 @@ void GdxsvBackendUdp::NetThreadLoop() {

char osd_msg[128] = {};
sprintf(osd_msg, "PING:%.0fms DELAY:%dfr", rtt, (int)gdxsv.maxlag_);
gui_display_notification(osd_msg, 3000);
os_notify(osd_msg, 3000);
state = State::McsInBattle;
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/gdxsv/gdxsv_emu_hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "nowide/fstream.hpp"
#include "oslib/directory.h"
#include "oslib/oslib.h"
#include "rend/boxart/http_client.h"
#include "oslib/http_client.h"
#include "rend/gui_util.h"
#include "stdclass.h"
#include "xxhash.h"
Expand Down
6 changes: 3 additions & 3 deletions core/gdxsv/gdxsv_key_display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "gdxsv.h"
#include "gdxsv_CustomTexture.h"
#include "imgui/imgui.h"
#include "rend/imgui_driver.h"
#include "ui/imgui_driver.h"
#include "rend/transform_matrix.h"
#include "types.h"

Expand Down Expand Up @@ -43,7 +43,7 @@ void GdxsvKeyDisplay::DisplayOSD() {
u8* imgData = gdx_custom_texture.LoadExtraTexture(ButtonsTextureName, false, w, h);

if (imgData) {
buttonsTexture = imguiDriver->updateTexture(ButtonsTextureName, imgData, w, h);
buttonsTexture = imguiDriver->updateTexture(ButtonsTextureName, imgData, w, h, false);
}
}

Expand All @@ -52,7 +52,7 @@ void GdxsvKeyDisplay::DisplayOSD() {
u8* imgData = gdx_custom_texture.LoadExtraTexture(ArrowsTextureName, false, w, h);

if (imgData) {
arrowsTexture = imguiDriver->updateTexture(ArrowsTextureName, imgData, w, h);
arrowsTexture = imguiDriver->updateTexture(ArrowsTextureName, imgData, w, h, false);
}
}

Expand Down
2 changes: 1 addition & 1 deletion core/gdxsv/gdxsv_network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <random>
#include <thread>

#include "rend/boxart/http_client.h"
#include "oslib/http_client.h"

#ifndef _WIN32
#include <sys/ioctl.h>
Expand Down
2 changes: 1 addition & 1 deletion core/gdxsv/gdxsv_replay_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "libs.h"
#include "oslib/directory.h"
#include "oslib/oslib.h"
#include "rend/boxart/http_client.h"
#include "oslib/http_client.h"
#include "rend/gui_util.h"
#include "stdclass.h"

Expand Down
2 changes: 1 addition & 1 deletion core/gdxsv/gdxsv_update.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include "json.hpp"
#include "libs.h"
#include "rend/boxart/http_client.h"
#include "oslib/http_client.h"
#include "version.h"

#if defined(_WIN32)
Expand Down
2 changes: 2 additions & 0 deletions core/hw/pvr/Renderer_if.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,12 @@ struct Renderer
Renderer() {
EventManager::listen(Event::Terminate, onEvent, this);
EventManager::listen(Event::LoadState, onEvent, this);
EventManager::listen(Event::GGPOGameEnd, onEvent, this);
}
virtual ~Renderer() {
EventManager::unlisten(Event::Terminate, onEvent, this);
EventManager::unlisten(Event::LoadState, onEvent, this);
EventManager::unlisten(Event::GGPOGameEnd, onEvent, this);
}

virtual bool Init() = 0;
Expand Down
4 changes: 2 additions & 2 deletions core/hw/sh4/dyna/blockmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ DynarecCodeEntryPtr DYNACALL bm_GetCodeByVAddr(u32 addr)
// Hack: skip something of game rendering function
if (settings.gdxsv.skipRenderingHack) {
if ((addr == 0x0c064cce && settings.gdxsv.disk == 1) || (addr == 0x0c0520e2 && settings.gdxsv.disk == 2)) {
next_pc += 4;
addr = next_pc;
Sh4cntx.pc += 4;
addr = Sh4cntx.pc;
}
}

Expand Down
2 changes: 2 additions & 0 deletions core/network/ggpo.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include <atomic>
#include <string>

#include "types.h"

struct MapleInputState;

namespace ggpo
Expand Down
3 changes: 2 additions & 1 deletion core/rend/TexCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@
*/
#include "TexCache.h"
// #include "CustomTexture.h"
// #include "../gdxsv/gdxsv_CustomTexture.h"
#include "gdxsv/gdxsv_CustomTexture.h"
#include "deps/xbrz/xbrz.h"
#include "hw/pvr/pvr_mem.h"
#include "hw/mem/addrspace.h"

#include <mutex>
#include <xxhash.h>


#ifdef _OPENMP
#include <omp.h>
#endif
Expand Down
24 changes: 1 addition & 23 deletions core/rend/gui_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "cfg/option.h"
#include "imgui/imgui.h"
#include "imgui/imgui_internal.h"
#include "gui.h"
#include "ui/gui.h"
#include "emulator.h"

#include <algorithm>
Expand Down Expand Up @@ -59,16 +59,6 @@ static inline void centerNextWindow()
ImGuiCond_Always, ImVec2(0.5f, 0.5f));
}

static inline bool operator==(const ImVec2& l, const ImVec2& r)
{
return l.x == r.x && l.y == r.y;
}

static inline bool operator!=(const ImVec2& l, const ImVec2& r)
{
return !(l == r);
}

void fullScreenWindow(bool modal);
void windowDragScroll();

Expand Down Expand Up @@ -129,18 +119,6 @@ struct ScaledVec2 : public ImVec2
inline static ImVec2 min(const ImVec2& l, const ImVec2& r) {
return ImVec2(std::min(l.x, r.x), std::min(l.y, r.y));
}
inline static ImVec2 operator+(const ImVec2& l, const ImVec2& r) {
return ImVec2(l.x + r.x, l.y + r.y);
}
inline static ImVec2 operator-(const ImVec2& l, const ImVec2& r) {
return ImVec2(l.x - r.x, l.y - r.y);
}
inline static ImVec2 operator*(const ImVec2& v, float f) {
return ImVec2(v.x * f, v.y * f);
}
inline static ImVec2 operator/(const ImVec2& v, float f) {
return ImVec2(v.x / f, v.y / f);
}

u8 *loadImage(const std::string& path, int& width, int& height);

Expand Down
19 changes: 0 additions & 19 deletions core/rend/vulkan/vulkan_renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,6 @@ class BaseVulkanRenderer : public Renderer
bool GetLastFrame(std::vector<u8>& data, int& width, int& height) override {
return GetContext()->GetLastFrame(data, width, height);
}

void RenderVideoRouting()
{
#if defined(VIDEO_ROUTING) && defined(TARGET_MAC)
if (config::VideoRouting)
{
auto device = GetContext()->GetDevice();
auto srcImage = device.getSwapchainImagesKHR(GetContext()->GetSwapChain())[GetContext()->GetCurrentImageIndex()];
auto graphicsQueue = device.getQueue(GetContext()->GetGraphicsQueueFamilyIndex(), 0);

int targetWidth = (config::VideoRoutingScale ? config::VideoRoutingVRes * settings.display.width / settings.display.height : settings.display.width);
int targetHeight = (config::VideoRoutingScale ? config::VideoRoutingVRes : settings.display.height);

extern void os_VideoRoutingPublishFrameTexture(const vk::Device& device, const vk::Image& image, const vk::Queue& queue, float x, float y, float w, float h);
os_VideoRoutingPublishFrameTexture(device, srcImage, graphicsQueue, 0, 0, targetWidth, targetHeight);
}
#endif
}


protected:
BaseVulkanRenderer() : viewport(640, 480) {}
Expand Down
Loading

0 comments on commit 301eb9a

Please sign in to comment.