-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Libs: CompanionUtil #2963
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Libs: CompanionUtil #2963
Changes from 3 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2ef2e12
impl
Fire-Cube cf66112
more
Fire-Cube 0c6a095
move log
Fire-Cube f9c7a22
cleanup type definitions
Fire-Cube 0e7470e
error code cleanup and clang
Fire-Cube 09d92e2
cleanup ugly RE code
Fire-Cube 51ea8fe
shame
Fire-Cube 296ac90
clang
Fire-Cube 93d12fa
Merge branch 'main' into companionutil
georgemoralis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
// SPDX-FileCopyrightText: Copyright 2025 shadPS4 Emulator Project | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
#include "common/logging/log.h" | ||
#include "core/libraries/error_codes.h" | ||
#include "core/libraries/libs.h" | ||
#include "core/libraries/companion/companion_util.h" | ||
|
||
namespace Libraries::CompanionUtil { | ||
|
||
uint32_t PS4_SYSV_ABI getEvent(sceCompanionUtilContext* ctx, sceCompanionUtilEvent* outEvent, | ||
s32 param_3) { | ||
uint32_t return_var; | ||
|
||
if (outEvent == 0) { | ||
return_var = ORBIS_COMPANION_UTIL_INVALID_ARGUMENT; | ||
} | ||
|
||
if (ctx == nullptr) { | ||
return_var = ORBIS_COMPANION_UTIL_INVALID_POINTER; | ||
} else { | ||
uint8_t* base = ctx->blob; | ||
int flag = *reinterpret_cast<int*>(base + 0x178); | ||
if (flag == 0) { | ||
return_var = ORBIS_COMPANION_UTIL_NO_EVENT; | ||
} else { | ||
return_var = ORBIS_COMPANION_UTIL_OK; | ||
} | ||
} | ||
|
||
return return_var; | ||
} | ||
|
||
s32 PS4_SYSV_ABI sceCompanionUtilGetEvent(sceCompanionUtilEvent* outEvent) { | ||
|
||
sceCompanionUtilContext* ctx = nullptr; | ||
uint32_t ret = getEvent(ctx, outEvent, | ||
1); | ||
uint32_t return_var; | ||
|
||
return_var = ret | 0xad0000; | ||
if (-1 < (int)ret) { | ||
return_var = ret; | ||
} | ||
|
||
LOG_DEBUG(Lib_CompanionUtil, "(STUBBED) called ret: {}", return_var); | ||
return return_var; | ||
} | ||
|
||
s32 PS4_SYSV_ABI sceCompanionUtilGetRemoteOskEvent() { | ||
LOG_ERROR(Lib_CompanionUtil, "(STUBBED) called"); | ||
return ORBIS_OK; | ||
} | ||
|
||
s32 PS4_SYSV_ABI sceCompanionUtilInitialize() { | ||
LOG_ERROR(Lib_CompanionUtil, "(STUBBED) called"); | ||
return ORBIS_OK; | ||
} | ||
|
||
s32 PS4_SYSV_ABI sceCompanionUtilOptParamInitialize() { | ||
LOG_ERROR(Lib_CompanionUtil, "(STUBBED) called"); | ||
return ORBIS_OK; | ||
} | ||
|
||
s32 PS4_SYSV_ABI sceCompanionUtilTerminate() { | ||
LOG_ERROR(Lib_CompanionUtil, "(STUBBED) called"); | ||
return ORBIS_OK; | ||
} | ||
|
||
void RegisterlibSceCompanionUtil(Core::Loader::SymbolsResolver* sym) { | ||
LIB_FUNCTION("cE5Msy11WhU", "libSceCompanionUtil", 1, "libSceCompanionUtil", 1, 1, | ||
sceCompanionUtilGetEvent); | ||
LIB_FUNCTION("MaVrz79mT5o", "libSceCompanionUtil", 1, "libSceCompanionUtil", 1, 1, | ||
sceCompanionUtilGetRemoteOskEvent); | ||
LIB_FUNCTION("xb1xlIhf0QY", "libSceCompanionUtil", 1, "libSceCompanionUtil", 1, 1, | ||
sceCompanionUtilInitialize); | ||
LIB_FUNCTION("IPN-FRSrafk", "libSceCompanionUtil", 1, "libSceCompanionUtil", 1, 1, | ||
sceCompanionUtilOptParamInitialize); | ||
LIB_FUNCTION("H1fYQd5lFAI", "libSceCompanionUtil", 1, "libSceCompanionUtil", 1, 1, | ||
sceCompanionUtilTerminate); | ||
}; | ||
|
||
} // namespace Libraries::CompanionUtil |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// SPDX-FileCopyrightText: Copyright 2025 shadPS4 Emulator Project | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
#pragma once | ||
|
||
#include "common/types.h" | ||
|
||
namespace Core::Loader { | ||
class SymbolsResolver; | ||
} | ||
|
||
namespace Libraries::CompanionUtil { | ||
|
||
static constexpr uint32_t ORBIS_COMPANION_UTIL_OK = 0; | ||
|
||
static constexpr uint32_t ORBIS_COMPANION_UTIL_INVALID_ARGUMENT = 0x80000004; | ||
Fire-Cube marked this conversation as resolved.
Show resolved
Hide resolved
|
||
static constexpr uint32_t ORBIS_COMPANION_UTIL_INVALID_POINTER = 0x80000006; | ||
static constexpr uint32_t ORBIS_COMPANION_UTIL_NO_EVENT = 0x80000008; | ||
|
||
struct sceCompanionUtilEvent { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the struct should be similar to the one i added in companion_httpd i will check |
||
std::uint8_t blob[0x104]{}; /// 0x104 bytes of data, dont know what it is exactly | ||
}; | ||
|
||
struct sceCompanionUtilContext { | ||
std::uint8_t blob[0x27B]{}; /// 0x27B bytes of data, dont know what it is exactly | ||
}; | ||
|
||
uint32_t PS4_SYSV_ABI getEvent(sceCompanionUtilContext* ctx, sceCompanionUtilEvent* outEvent, | ||
s32 param_3); | ||
s32 PS4_SYSV_ABI sceCompanionUtilGetEvent(sceCompanionUtilEvent* outEvent); | ||
s32 PS4_SYSV_ABI sceCompanionUtilGetRemoteOskEvent(); | ||
s32 PS4_SYSV_ABI sceCompanionUtilInitialize(); | ||
s32 PS4_SYSV_ABI sceCompanionUtilOptParamInitialize(); | ||
s32 PS4_SYSV_ABI sceCompanionUtilTerminate(); | ||
|
||
void RegisterlibSceCompanionUtil(Core::Loader::SymbolsResolver* sym); | ||
} // namespace Libraries::CompanionUtil |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.