mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-21 02:45:00 +00:00
Add auto stubs, static init
- Adds a python script to generate the tables, to avoid std::map init - Generates stub "slots" to provide runtime information when a stub is called - Provides fallback for unknown stubs
This commit is contained in:
parent
1e18efcd05
commit
f1ce6fe669
9 changed files with 22633 additions and 11232 deletions
38
src/Core/PS4/Util/aerolib.cpp
Normal file
38
src/Core/PS4/Util/aerolib.cpp
Normal file
|
@ -0,0 +1,38 @@
|
|||
#include "aerolib.h"
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "Util/log.h"
|
||||
|
||||
namespace aerolib {
|
||||
|
||||
// Use a direct table here + binary search as contents are static
|
||||
nid_entry nids[] = {
|
||||
#define STUB(nid, name) \
|
||||
{ nid, #name },
|
||||
#include "aerolib.inl"
|
||||
#undef STUB
|
||||
};
|
||||
|
||||
nid_entry* find_by_nid(const char* nid) {
|
||||
s64 l = 0;
|
||||
s64 r = sizeof(nids) / sizeof(nids[0]) - 1;
|
||||
|
||||
while (l <= r) {
|
||||
size_t m = l + (r - l) / 2;
|
||||
|
||||
int cmp = strcmp(nids[m].nid, nid);
|
||||
|
||||
if (cmp == 0)
|
||||
return &nids[m];
|
||||
else if (cmp < 0)
|
||||
l = m + 1;
|
||||
else
|
||||
r = m - 1;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
} // namespace aerolib
|
Loading…
Add table
Add a link
Reference in a new issue