mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-20 18:34:58 +00:00
- 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
38 lines
No EOL
676 B
C++
38 lines
No EOL
676 B
C++
#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
|