Skip to content

Commit 99ac10a

Browse files
squidbusXphalnosStevenMiller123
authored
libraries: Add libSceRazorCpu HLE skeleton. (#1624)
* Remove save migration code (#1621) * Kernel Fixes (#1605) * scePthreadSetprio Changes FindThread uses posix error codes, so the function export should apply the ORBIS wrapper to convert these. Since it uses posix codes, I've also renamed the function to align with other posix functions. Lastly, this fixes a compile warning about ret sometimes not getting initialized. * Implement posix_munmap Used by Hatsune Miku Project Diva X during intros. May help with stability on Linux, probably won't change anything on Windows. * Exports Some missing function exports I've seen in my tests. sceKernelAvailableFlexibleMemorySize export is used in Final Fantasy XV Episode Duscae posix_pthread_setprio and posix_pthread_getschedparam are used by Spider-Man Miles Morales scePthreadKeyDelete is used in UE4 games. I've also added in a typo fix related to my previous PR. * libScePosix export for posix_pthread_attr_setguardsize Used in Hatsune Miku Project Diva X v1.02 * libraries: Add libSceRazorCpu HLE skeleton. --------- Co-authored-by: ¥IGA <[email protected]> Co-authored-by: Stephen Miller <[email protected]>
1 parent 7bf168e commit 99ac10a

File tree

8 files changed

+309
-22
lines changed

8 files changed

+309
-22
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,8 @@ set(SYSTEM_LIBS src/core/libraries/system/commondialog.cpp
318318
src/core/libraries/remote_play/remoteplay.h
319319
src/core/libraries/share_play/shareplay.cpp
320320
src/core/libraries/share_play/shareplay.h
321+
src/core/libraries/razor_cpu/razor_cpu.cpp
322+
src/core/libraries/razor_cpu/razor_cpu.h
321323
)
322324

323325
set(VIDEOOUT_LIB src/core/libraries/videoout/buffer.h

src/common/config.cpp

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33

44
#include <fstream>
55
#include <string>
6-
#include <common/version.h>
76
#include <fmt/core.h>
87
#include <fmt/xchar.h> // for wstring support
98
#include <toml.hpp>
10-
#include "common/logging/formatter.h"
9+
1110
#include "common/path_util.h"
1211
#include "config.h"
12+
#include "logging/formatter.h"
13+
#include "version.h"
1314

1415
namespace toml {
1516
template <typename TC, typename K>
@@ -81,7 +82,8 @@ std::vector<std::string> m_pkg_viewer;
8182
std::vector<std::string> m_elf_viewer;
8283
std::vector<std::string> m_recent_files;
8384
std::string emulator_language = "en";
84-
// Settings
85+
86+
// Language
8587
u32 m_language = 1; // english
8688

8789
bool isNeoMode() {
@@ -334,6 +336,7 @@ void setMainWindowGeometry(u32 x, u32 y, u32 w, u32 h) {
334336
main_window_geometry_w = w;
335337
main_window_geometry_h = h;
336338
}
339+
337340
bool addGameInstallDir(const std::filesystem::path& dir) {
338341
if (std::find(settings_install_dirs.begin(), settings_install_dirs.end(), dir) ==
339342
settings_install_dirs.end()) {
@@ -342,47 +345,60 @@ bool addGameInstallDir(const std::filesystem::path& dir) {
342345
}
343346
return false;
344347
}
348+
345349
void removeGameInstallDir(const std::filesystem::path& dir) {
346350
auto iterator = std::find(settings_install_dirs.begin(), settings_install_dirs.end(), dir);
347351
if (iterator != settings_install_dirs.end()) {
348352
settings_install_dirs.erase(iterator);
349353
}
350354
}
355+
351356
void setAddonInstallDir(const std::filesystem::path& dir) {
352357
settings_addon_install_dir = dir;
353358
}
359+
354360
void setMainWindowTheme(u32 theme) {
355361
mw_themes = theme;
356362
}
363+
357364
void setIconSize(u32 size) {
358365
m_icon_size = size;
359366
}
367+
360368
void setIconSizeGrid(u32 size) {
361369
m_icon_size_grid = size;
362370
}
371+
363372
void setSliderPosition(u32 pos) {
364373
m_slider_pos = pos;
365374
}
375+
366376
void setSliderPositionGrid(u32 pos) {
367377
m_slider_pos_grid = pos;
368378
}
379+
369380
void setTableMode(u32 mode) {
370381
m_table_mode = mode;
371382
}
383+
372384
void setMainWindowWidth(u32 width) {
373385
m_window_size_W = width;
374386
}
387+
375388
void setMainWindowHeight(u32 height) {
376389
m_window_size_H = height;
377390
}
391+
378392
void setPkgViewer(const std::vector<std::string>& pkgList) {
379393
m_pkg_viewer.resize(pkgList.size());
380394
m_pkg_viewer = pkgList;
381395
}
396+
382397
void setElfViewer(const std::vector<std::string>& elfList) {
383398
m_elf_viewer.resize(elfList.size());
384399
m_elf_viewer = elfList;
385400
}
401+
386402
void setRecentFiles(const std::vector<std::string>& recentFiles) {
387403
m_recent_files.resize(recentFiles.size());
388404
m_recent_files = recentFiles;
@@ -395,55 +411,71 @@ void setEmulatorLanguage(std::string language) {
395411
u32 getMainWindowGeometryX() {
396412
return main_window_geometry_x;
397413
}
414+
398415
u32 getMainWindowGeometryY() {
399416
return main_window_geometry_y;
400417
}
418+
401419
u32 getMainWindowGeometryW() {
402420
return main_window_geometry_w;
403421
}
422+
404423
u32 getMainWindowGeometryH() {
405424
return main_window_geometry_h;
406425
}
426+
407427
const std::vector<std::filesystem::path>& getGameInstallDirs() {
408428
return settings_install_dirs;
409429
}
430+
410431
std::filesystem::path getAddonInstallDir() {
411432
if (settings_addon_install_dir.empty()) {
412433
// Default for users without a config file or a config file from before this option existed
413434
return Common::FS::GetUserPath(Common::FS::PathType::UserDir) / "addcont";
414435
}
415436
return settings_addon_install_dir;
416437
}
438+
417439
u32 getMainWindowTheme() {
418440
return mw_themes;
419441
}
442+
420443
u32 getIconSize() {
421444
return m_icon_size;
422445
}
446+
423447
u32 getIconSizeGrid() {
424448
return m_icon_size_grid;
425449
}
450+
426451
u32 getSliderPosition() {
427452
return m_slider_pos;
428453
}
454+
429455
u32 getSliderPositionGrid() {
430456
return m_slider_pos_grid;
431457
}
458+
432459
u32 getTableMode() {
433460
return m_table_mode;
434461
}
462+
435463
u32 getMainWindowWidth() {
436464
return m_window_size_W;
437465
}
466+
438467
u32 getMainWindowHeight() {
439468
return m_window_size_H;
440469
}
470+
441471
std::vector<std::string> getPkgViewer() {
442472
return m_pkg_viewer;
443473
}
474+
444475
std::vector<std::string> getElfViewer() {
445476
return m_elf_viewer;
446477
}
478+
447479
std::vector<std::string> getRecentFiles() {
448480
return m_recent_files;
449481
}
@@ -455,6 +487,7 @@ std::string getEmulatorLanguage() {
455487
u32 GetLanguage() {
456488
return m_language;
457489
}
490+
458491
void load(const std::filesystem::path& path) {
459492
// If the configuration file does not exist, create it and return
460493
std::error_code error;
@@ -545,18 +578,6 @@ void load(const std::filesystem::path& path) {
545578
m_window_size_W = toml::find_or<int>(gui, "mw_width", 0);
546579
m_window_size_H = toml::find_or<int>(gui, "mw_height", 0);
547580

548-
// TODO Migration code, after a major release this should be removed.
549-
auto old_game_install_dir = toml::find_fs_path_or(gui, "installDir", {});
550-
if (!old_game_install_dir.empty()) {
551-
addGameInstallDir(std::filesystem::path{old_game_install_dir});
552-
} else {
553-
const auto install_dir_array =
554-
toml::find_or<std::vector<std::string>>(gui, "installDirs", {});
555-
for (const auto& dir : install_dir_array) {
556-
addGameInstallDir(std::filesystem::path{dir});
557-
}
558-
}
559-
560581
settings_addon_install_dir = toml::find_fs_path_or(gui, "addonInstallDir", {});
561582
main_window_geometry_x = toml::find_or<int>(gui, "geometry_x", 0);
562583
main_window_geometry_y = toml::find_or<int>(gui, "geometry_y", 0);
@@ -575,6 +596,7 @@ void load(const std::filesystem::path& path) {
575596
m_language = toml::find_or<int>(settings, "consoleLanguage", 1);
576597
}
577598
}
599+
578600
void save(const std::filesystem::path& path) {
579601
toml::value data;
580602

@@ -655,9 +677,6 @@ void save(const std::filesystem::path& path) {
655677

656678
data["Settings"]["consoleLanguage"] = m_language;
657679

658-
// TODO Migration code, after a major release this should be removed.
659-
data.at("GUI").as_table().erase("installDir");
660-
661680
std::ofstream file(path, std::ios::binary);
662681
file << data;
663682
file.close();

src/common/logging/filter.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ bool ParseFilterRule(Filter& instance, Iterator begin, Iterator end) {
121121
SUB(Lib, Fiber) \
122122
SUB(Lib, Vdec2) \
123123
SUB(Lib, Videodec) \
124+
SUB(Lib, RazorCpu) \
124125
CLS(Frontend) \
125126
CLS(Render) \
126127
SUB(Render, Vulkan) \

src/common/logging/types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ enum class Class : u8 {
8888
Lib_Fiber, ///< The LibSceFiber implementation.
8989
Lib_Vdec2, ///< The LibSceVideodec2 implementation.
9090
Lib_Videodec, ///< The LibSceVideodec implementation.
91+
Lib_RazorCpu, ///< The LibRazorCpu implementation.
9192
Frontend, ///< Emulator UI
9293
Render, ///< Video Core
9394
Render_Vulkan, ///< Vulkan backend

src/core/libraries/libs.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "core/libraries/pad/pad.h"
2929
#include "core/libraries/playgo/playgo.h"
3030
#include "core/libraries/random/random.h"
31+
#include "core/libraries/razor_cpu/razor_cpu.h"
3132
#include "core/libraries/remote_play/remoteplay.h"
3233
#include "core/libraries/rtc/rtc.h"
3334
#include "core/libraries/save_data/dialog/savedatadialog.h"
@@ -87,6 +88,7 @@ void InitHLELibs(Core::Loader::SymbolsResolver* sym) {
8788
Libraries::SharePlay::RegisterlibSceSharePlay(sym);
8889
Libraries::Remoteplay::RegisterlibSceRemoteplay(sym);
8990
Libraries::Videodec::RegisterlibSceVideodec(sym);
91+
Libraries::RazorCpu::RegisterlibSceRazorCpu(sym);
9092
}
9193

9294
} // namespace Libraries

0 commit comments

Comments
 (0)