KV

版本 v0.0.5·更新於 2026-01-28

A simple KV Store for N64Recomp projects

模組介紹 作者原文

KV

A simple KV Store for N64Recomp projects

Usage

Add the dependency in your mod.toml

dependencies = [

"ProxyBK_KV:0.0.5"

]

Add the header to your project

ifndef PROXYBK_KV_H

define PROXYBK_KV_H

include "modding.h"

include "PR/ultratypes.h"

// Global

RECOMP_IMPORT("ProxyBK_KV", bool KV_Global_Get(const char key, void dest, u32 size));

RECOMP_IMPORT("ProxyBK_KV", u8 KV_Global_Get_U8(const char* key, u8 defaultValue));

RECOMP_IMPORT("ProxyBK_KV", s8 KV_Global_Get_S8(const char* key, s8 defaultValue));

RECOMP_IMPORT("ProxyBK_KV", u16 KV_Global_Get_U16(const char* key, u16 defaultValue));

RECOMP_IMPORT("ProxyBK_KV", s16 KV_Global_Get_S16(const char* key, s16 defaultValue));

RECOMP_IMPORT("ProxyBK_KV", u32 KV_Global_Get_U32(const char* key, u32 defaultValue));

RECOMP_IMPORT("ProxyBK_KV", s32 KV_Global_Get_S32(const char* key, s32 defaultValue));

RECOMP_IMPORT("ProxyBK_KV", bool KV_Global_Set(const char key, void data, u32 size));

RECOMP_IMPORT("ProxyBK_KV", bool KV_Global_Set_U8(const char* key, u8 value));

RECOMP_IMPORT("ProxyBK_KV", bool KV_Global_Set_S8(const char* key, s8 value));

RECOMP_IMPORT("ProxyBK_KV", bool KV_Global_Set_U16(const char* key, u16 value));

RECOMP_IMPORT("ProxyBK_KV", bool KV_Global_Set_S16(const char* key, s16 value));

RECOMP_IMPORT("ProxyBK_KV", bool KV_Global_Set_U32(const char* key, u32 value));

RECOMP_IMPORT("ProxyBK_KV", bool KV_Global_Set_S32(const char* key, s32 value));

RECOMP_IMPORT("ProxyBK_KV", bool KV_Global_Has(const char* key));

RECOMP_IMPORT("ProxyBK_KV", bool KV_Global_Remove(const char* key));

// Save Slot based

RECOMP_IMPORT("ProxyBK_KV", bool KV_Slot_Get(const char key, void dest, u32 size));

RECOMP_IMPORT("ProxyBK_KV", u8 KV_Slot_Get_U8(const char* key, u8 defaultValue));

RECOMP_IMPORT("ProxyBK_KV", s8 KV_Slot_Get_S8(const char* key, s8 defaultValue));

RECOMP_IMPORT("ProxyBK_KV", u16 KV_Slot_Get_U16(const char* key, u16 defaultValue));

RECOMP_IMPORT("ProxyBK_KV", s16 KV_Slot_Get_S16(const char* key, s16 defaultValue));

RECOMP_IMPORT("ProxyBK_KV", u32 KV_Slot_Get_U32(const char* key, u32 defaultValue));

RECOMP_IMPORT("ProxyBK_KV", s32 KV_Slot_Get_S32(const char* key, s32 defaultValue));

RECOMP_IMPORT("ProxyBK_KV", bool KV_Slot_Set(const char key, void data, u32 size));

RECOMP_IMPORT("ProxyBK_KV", bool KV_Slot_Set_U8(const char* key, u8 value));

RECOMP_IMPORT("ProxyBK_KV", bool KV_Slot_Set_S8(const char* key, s8 value));

RECOMP_IMPORT("ProxyBK_KV", bool KV_Slot_Set_U16(const char* key, u16 value));

RECOMP_IMPORT("ProxyBK_KV", bool KV_Slot_Set_S16(const char* key, s16 value));

RECOMP_IMPORT("ProxyBK_KV", bool KV_Slot_Set_U32(const char* key, u32 value));

RECOMP_IMPORT("ProxyBK_KV", bool KV_Slot_Set_S32(const char* key, s32 value));

RECOMP_IMPORT("ProxyBK_KV", bool KV_Slot_Has(const char* key));

RECOMP_IMPORT("ProxyBK_KV", bool KV_Slot_Remove(const char* key));

endif // PROXYBK_KV_H

Start Getting/Setting values

u32 myValue = 4941;

KV_Slot_Set_U32("MyMod.MyValue", myValue);

u32 otherValue = KV_Slot_Get_U32("MyMod.MyValue", 1337);

assert(myValue == otherValue);

Getting complex values

struct MyStruct {

u32 a;

u32 b;

};

MyStruct myStruct = { 1, 2 };

KV_Slot_Set("MyMod.MyStruct", &myStruct, sizeof(MyStruct));

MyStruct otherStruct;

// Get returns truthy if the value was retrieved

if (KV_Slot_Get("MyMod.MyStruct", &otherStruct, sizeof(MyStruct))) {

assert(myStruct.a == otherStruct.a);

assert(myStruct.b == otherStruct.b);

}

安裝與使用 安裝:按包內說明操作

  1. 解壓本站下載的壓縮包,先讀包內的 readme / 說明檔案。
  2. 多數模組依賴遊戲的模組載入器:常見做法是用社群模組管理器(如 r2modman)選中本遊戲安裝,由管理器自動處理載入器與依賴。
  3. 手動安裝時,把模組檔案放進遊戲目錄下對應的 Mod / plugins 資料夾。
  4. 啟動遊戲確認載入成功;帶「前置依賴」的模組需要把依賴一併安裝。

不同模組的安裝位置差異較大,包內說明是最可靠的依據。

檔案與校驗

檔案名稱
KV-0.0.5.zip
檔案大小
9.3 MiB