mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-05 00:42:48 +00:00
libraries: add zlib hle skeleton/stub
This commit is contained in:
parent
2837d848ed
commit
976a5713f5
@ -440,6 +440,11 @@ set(NP_LIBS src/core/libraries/np_common/np_common.cpp
|
||||
src/core/libraries/np_party/np_party.h
|
||||
)
|
||||
|
||||
set(ZLIB_LIB src/core/libraries/zlib/zlib.cpp
|
||||
src/core/libraries/zlib/zlib.h
|
||||
src/core/libraries/zlib/zlib_error.h
|
||||
)
|
||||
|
||||
set(MISC_LIBS src/core/libraries/screenshot/screenshot.cpp
|
||||
src/core/libraries/screenshot/screenshot.h
|
||||
src/core/libraries/move/move.cpp
|
||||
@ -612,6 +617,7 @@ set(CORE src/core/aerolib/stubs.cpp
|
||||
${PLAYGO_LIB}
|
||||
${RANDOM_LIB}
|
||||
${USBD_LIB}
|
||||
${ZLIB_LIB}
|
||||
${MISC_LIBS}
|
||||
${IME_LIB}
|
||||
${FIBER_LIB}
|
||||
|
@ -133,6 +133,7 @@ bool ParseFilterRule(Filter& instance, Iterator begin, Iterator end) {
|
||||
SUB(Lib, Mouse) \
|
||||
SUB(Lib, WebBrowserDialog) \
|
||||
SUB(Lib, NpParty) \
|
||||
SUB(Lib, Zlib) \
|
||||
CLS(Frontend) \
|
||||
CLS(Render) \
|
||||
SUB(Render, Vulkan) \
|
||||
|
@ -100,6 +100,7 @@ enum class Class : u8 {
|
||||
Lib_Mouse, ///< The LibSceMouse implementation
|
||||
Lib_WebBrowserDialog, ///< The LibSceWebBrowserDialog implementation
|
||||
Lib_NpParty, ///< The LibSceNpParty implementation
|
||||
Lib_Zlib, ///< The LibSceZlib implementation.
|
||||
Frontend, ///< Emulator UI
|
||||
Render, ///< Video Core
|
||||
Render_Vulkan, ///< Vulkan backend
|
||||
|
@ -54,6 +54,7 @@
|
||||
#include "core/libraries/videodec/videodec2.h"
|
||||
#include "core/libraries/videoout/video_out.h"
|
||||
#include "core/libraries/web_browser_dialog/webbrowserdialog.h"
|
||||
#include "core/libraries/zlib/zlib.h"
|
||||
#include "fiber/fiber.h"
|
||||
#include "jpeg/jpegenc.h"
|
||||
|
||||
@ -111,6 +112,7 @@ void InitHLELibs(Core::Loader::SymbolsResolver* sym) {
|
||||
Libraries::Mouse::RegisterlibSceMouse(sym);
|
||||
Libraries::WebBrowserDialog::RegisterlibSceWebBrowserDialog(sym);
|
||||
Libraries::NpParty::RegisterlibSceNpParty(sym);
|
||||
Libraries::Zlib::RegisterlibSceZlib(sym);
|
||||
}
|
||||
|
||||
} // namespace Libraries
|
||||
|
69
src/core/libraries/zlib/zlib.cpp
Normal file
69
src/core/libraries/zlib/zlib.cpp
Normal file
@ -0,0 +1,69 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/logging/log.h"
|
||||
#include "common/singleton.h"
|
||||
#include "core/libraries/error_codes.h"
|
||||
#include "core/libraries/kernel/equeue.h"
|
||||
#include "core/libraries/libs.h"
|
||||
#include "core/libraries/zlib/zlib_error.h"
|
||||
|
||||
namespace Libraries::Zlib {
|
||||
|
||||
int PS4_SYSV_ABI sceZlibInitialize(const void* buffer, std::size_t length) {
|
||||
LOG_ERROR(Lib_Zlib, "(STUBBED)called");
|
||||
|
||||
// buffer and length passed as 0 is expected behavior, though module may use them in
|
||||
// specific ways.
|
||||
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceZlibInflate(const void* source, u32 sourceLength, void* destination,
|
||||
u32 destinationLength, u64* requestId) {
|
||||
LOG_ERROR(Lib_Zlib, "(STUBBED)called");
|
||||
|
||||
if (!source || !sourceLength || !destination || !destinationLength ||
|
||||
destinationLength > 64_KB || destinationLength % 2_KB != 0)
|
||||
return ORBIS_ZLIB_ERROR_INVALID;
|
||||
|
||||
*requestId = 0;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceZlibWaitForDone(u64* requestId, u32* timeout) {
|
||||
LOG_ERROR(Lib_Zlib, "(STUBBED)called");
|
||||
if (!requestId)
|
||||
return ORBIS_ZLIB_ERROR_INVALID;
|
||||
|
||||
// timeout is checked by sceKernelWaitEqueue
|
||||
|
||||
*requestId = 0;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceZlibGetResult(u64 requestId, u32* destinationLength, int* status) {
|
||||
LOG_ERROR(Lib_Zlib, "(STUBBED)called");
|
||||
|
||||
if (!destinationLength || !status)
|
||||
return ORBIS_ZLIB_ERROR_INVALID;
|
||||
|
||||
*destinationLength = 0;
|
||||
*status = 0;
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI sceZlibFinalize() {
|
||||
LOG_ERROR(Lib_Zlib, "(STUBBED)called");
|
||||
return ORBIS_OK;
|
||||
}
|
||||
|
||||
void RegisterlibSceZlib(Core::Loader::SymbolsResolver* sym) {
|
||||
LIB_FUNCTION("m1YErdIXCp4", "libSceZlib", 1, "libSceZlib", 1, 1, sceZlibInitialize);
|
||||
LIB_FUNCTION("6na+Sa-B83w", "libSceZlib", 1, "libSceZlib", 1, 1, sceZlibFinalize);
|
||||
LIB_FUNCTION("TLar1HULv1Q", "libSceZlib", 1, "libSceZlib", 1, 1, sceZlibInflate);
|
||||
LIB_FUNCTION("uB8VlDD4e0s", "libSceZlib", 1, "libSceZlib", 1, 1, sceZlibWaitForDone);
|
||||
LIB_FUNCTION("2eDcGHC0YaM", "libSceZlib", 1, "libSceZlib", 1, 1, sceZlibGetResult);
|
||||
};
|
||||
|
||||
} // namespace Libraries::Zlib
|
21
src/core/libraries/zlib/zlib.h
Normal file
21
src/core/libraries/zlib/zlib.h
Normal file
@ -0,0 +1,21 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common/types.h"
|
||||
|
||||
namespace Core::Loader {
|
||||
class SymbolsResolver;
|
||||
}
|
||||
namespace Libraries::Zlib {
|
||||
|
||||
int PS4_SYSV_ABI sceZlibInitialize(const void* buffer, std::size_t length);
|
||||
int PS4_SYSV_ABI sceZlibInflate(const void* source, u32 sourceLength, void* destination,
|
||||
u32 destinationLength, u64* requestId);
|
||||
int PS4_SYSV_ABI sceZlibWaitForDone(u64* requestId, u32* timeout);
|
||||
int PS4_SYSV_ABI sceZlibGetResult(u64 requestId, u32* destinationLength, int* status);
|
||||
int PS4_SYSV_ABI sceZlibFinalize();
|
||||
|
||||
void RegisterlibSceZlib(Core::Loader::SymbolsResolver* sym);
|
||||
} // namespace Libraries::Zlib
|
18
src/core/libraries/zlib/zlib_error.h
Normal file
18
src/core/libraries/zlib/zlib_error.h
Normal file
@ -0,0 +1,18 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/libraries/error_codes.h"
|
||||
|
||||
// Zlib library
|
||||
constexpr int ORBIS_ZLIB_ERROR_NOT_FOUND = 0x81120002;
|
||||
constexpr int ORBIS_ZLIB_ERROR_AGAIN = 0x80ED0002;
|
||||
constexpr int ORBIS_ZLIB_ERROR_FAULT = 0x8112000E;
|
||||
constexpr int ORBIS_ZLIB_ERROR_INVALID = 0x81120016;
|
||||
constexpr int ORBIS_ZLIB_ERROR_NOSPACE = 0x8112001C;
|
||||
constexpr int ORBIS_ZLIB_ERROR_NOT_SUPPORTED = 0x81120025;
|
||||
constexpr int ORBIS_ZLIB_ERROR_TIMEDOUT = 0x81120027;
|
||||
constexpr int ORBIS_ZLIB_ERROR_NOT_INITIALIZED = 0x81120032;
|
||||
constexpr int ORBIS_ZLIB_ERROR_ALREADY_INITIALIZED = 0x81120033;
|
||||
constexpr int ORBIS_ZLIB_ERROR_FATAL = 0x811200FF;
|
Loading…
Reference in New Issue
Block a user