mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Minor cleanups, revert change in sceKernelMbx
This commit is contained in:
1 parent
d6b33ba58d
commit
2b509e4b1e
4 files changed
+29
-22
No files matched your search
@@ -124,18 +124,16 @@ struct Mbx : public KernelObject
|
||||
|
||||
int ReceiveMessage(u32 receivePtr) {
|
||||
u32 ptr = nmb.packetListHead;
|
||||
if (!Memory::IsValidAddress(nmb.packetListHead)) {
|
||||
return SCE_KERNEL_ERROR_ILLEGAL_ADDR;
|
||||
}
|
||||
|
||||
// Check over the linked list and reset the head.
|
||||
int c = 0;
|
||||
while (true)
|
||||
{
|
||||
while (true) {
|
||||
u32 next = Memory::Read_U32(nmb.packetListHead);
|
||||
if (!Memory::IsValidAddress(next))
|
||||
return SCE_KERNEL_ERROR_ILLEGAL_ADDR;
|
||||
if (next == nmb.packetListHead) {
|
||||
// This will cause us to spin if we don't check for it. Not sure what the correct behavior here is.
|
||||
return SCE_KERNEL_ERROR_ILLEGAL_ADDR;
|
||||
}
|
||||
if (next == ptr) {
|
||||
if (nmb.packetListHead != ptr) {
|
||||
next = Memory::Read_U32(next);
|
||||
@@ -158,12 +156,10 @@ struct Mbx : public KernelObject
|
||||
// Tell the receiver about the message.
|
||||
Memory::Write_U32(ptr, receivePtr);
|
||||
nmb.numMessages--;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DoState(PointerWrap &p) override
|
||||
{
|
||||
void DoState(PointerWrap &p) override {
|
||||
auto s = p.Section("Mbx", 1);
|
||||
if (!s)
|
||||
return;
|
||||
|
||||
+15
-5
@@ -952,6 +952,11 @@ const KeyValue ROOT[] = {
|
||||
|
||||
// Updater checks for CONFIG/SYSTEM/XMB.
|
||||
|
||||
// not sure what modes exist, this is conjecture.
|
||||
enum RegOpenMode {
|
||||
REG_OPEN_READONLY = 2,
|
||||
};
|
||||
|
||||
void __RegInit() {
|
||||
g_openRegistryMode = 0;
|
||||
g_handleGen = 1337;
|
||||
@@ -1012,6 +1017,11 @@ int sceRegOpenRegistry(u32 regParamAddr, int mode, u32 regHandleAddr) {
|
||||
Memory::WriteUnchecked_U32(0, regHandleAddr);
|
||||
}
|
||||
g_openRegistryMode = mode;
|
||||
|
||||
if (g_openRegistryMode != REG_OPEN_READONLY) {
|
||||
WARN_LOG(Log::HLE, "sceRegOpenRegistry: Opening registry in non-readonly mode. This is not yet supported (we'll simply emulate it as read-only anyway).");
|
||||
}
|
||||
|
||||
return hleLogInfo(Log::sceReg, 0);
|
||||
}
|
||||
|
||||
@@ -1120,12 +1130,12 @@ int sceRegGetKeys(int catHandle, u32 bufAddr, int num) {
|
||||
return hleLogError(Log::sceReg, 0, "Not an open category");
|
||||
}
|
||||
|
||||
if (!Memory::IsValidRange(bufAddr, num * 27)) {
|
||||
const int keyLen = 27; // 27 bytes per key name, including null terminator. For some reason?!?
|
||||
|
||||
if (!Memory::IsValidRange(bufAddr, num * keyLen)) {
|
||||
return hleLogError(Log::sceReg, -1, "bad output addr");
|
||||
}
|
||||
|
||||
const int addrLen = 27; // for some reason
|
||||
|
||||
int count = 0;
|
||||
const KeyValue *keyvals = LookupCategory(iter->second.path, &count);
|
||||
if (!keyvals) {
|
||||
@@ -1135,8 +1145,8 @@ int sceRegGetKeys(int catHandle, u32 bufAddr, int num) {
|
||||
count = std::min(count, num);
|
||||
|
||||
for (int i = 0; i < num; i++) {
|
||||
char *dest = (char *)Memory::GetPointerWrite(bufAddr + i * 27);
|
||||
strncpy(dest, keyvals[i].name.c_str(), 27);
|
||||
char *dest = (char *)Memory::GetPointerWrite(bufAddr + i * keyLen);
|
||||
strncpy(dest, keyvals[i].name.c_str(), keyLen);
|
||||
}
|
||||
|
||||
return hleLogInfo(Log::sceReg, 0);
|
||||
|
||||
@@ -21,10 +21,10 @@
|
||||
// Official git repository and contact information can be found at
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
|
||||
// Most of the code are based on https://github.com/RJ/libportfwd and updated to the latest miniupnp library
|
||||
// All credit goes to him and the official miniupnp project! http://miniupnp.free.fr/
|
||||
|
||||
|
||||
#include <algorithm> // find_if
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
@@ -43,10 +43,10 @@
|
||||
#include "Core/Util/PortManager.h"
|
||||
|
||||
PortManager g_PortManager;
|
||||
bool upnpServiceRunning = false;
|
||||
std::thread upnpServiceThread;
|
||||
std::recursive_mutex upnpLock;
|
||||
std::deque<UPnPArgs> upnpReqs;
|
||||
static bool upnpServiceRunning = false;
|
||||
static std::thread upnpServiceThread;
|
||||
static std::recursive_mutex upnpLock;
|
||||
static std::deque<UPnPArgs> upnpReqs;
|
||||
|
||||
PortManager::PortManager():
|
||||
m_InitState(UPNP_INITSTATE_NONE),
|
||||
@@ -549,4 +549,3 @@ void UPnP_Remove(const char* protocol, unsigned short port) {
|
||||
std::lock_guard<std::recursive_mutex> upnpGuard(upnpLock);
|
||||
upnpReqs.push_back({ UPNP_CMD_REMOVE, protocol, port, port });
|
||||
}
|
||||
|
||||
@@ -283,8 +283,6 @@ tests_good = [
|
||||
"threads/mbx/poll/poll",
|
||||
"threads/mbx/priority/priority",
|
||||
"threads/mbx/receive/receive",
|
||||
"threads/mbx/refer/refer",
|
||||
"threads/mbx/send/send",
|
||||
"threads/msgpipe/msgpipe",
|
||||
"threads/msgpipe/cancel",
|
||||
"threads/msgpipe/create",
|
||||
@@ -471,6 +469,10 @@ tests_next = [
|
||||
"threads/callbacks/cancel",
|
||||
"threads/callbacks/count",
|
||||
"threads/callbacks/notify",
|
||||
# These two mbx tests only appeared to work because they papered over bugs
|
||||
"threads/mbx/refer/refer",
|
||||
"threads/mbx/send/send",
|
||||
|
||||
"threads/scheduling/dispatch",
|
||||
"threads/scheduling/scheduling",
|
||||
"threads/threads/create",
|
||||
|
||||
Reference in new issue
Block a user