unify file locations

This commit is contained in:
2025-05-03 00:34:26 +03:00
parent c6c1435f8a
commit a4af280cda
28 changed files with 73 additions and 926 deletions

46
src/moduler.h Normal file
View File

@@ -0,0 +1,46 @@
#ifndef MODULER_H_
#define MODULER_H_
#include "vector.h"
#include "memory.h"
#include "symbols.h"
#include "types.h"
struct HiloadContext;
typedef enum {
HI_MODULE_STATE_DIRTY = (1 << 0),
HI_MODULE_STATE_PATCHABLE = (1 << 6), // non system module we will modify
HI_MODULE_STATE_EXEC = (1 << 7), // denote the current executable
} ModuleFlags;
typedef u8 ModuleInfo;
typedef struct {
const char *name; // Filename
void *dlhandle;
uptr address;
ModuleInfo info;
} ModuleData;
sc_array_def(ModuleData, module);
typedef struct sc_array_module VectorModuleData;
static inline ModuleInfo hi_modinfo_add(ModuleInfo flags, ModuleFlags flag) {
return flags | flag;
}
static inline ModuleInfo hi_modinfo_clear(ModuleInfo flags,
ModuleFlags flag) {
return flags & ~flag;
}
static inline bool hi_modinfo_has(ModuleInfo flags, ModuleFlags flag) {
return (flags & flag) != 0;
}
#define HI_MODINFO_SET(info, flag) ((info) |= flag)
#define HI_MODINFO_CLEAR(info, flag) ((info) &= ~flag)
HiResult moduler_reload(VectorModuleData *modules, ModuleData *module,
VectorMemoryRegion *memregs);
#endif // MODULER_H_