Add files to make libnx
This commit is contained in:
parent
57c5dabe68
commit
e0e70d16f3
3 changed files with 700 additions and 0 deletions
302
libnxGen.cfg
Normal file
302
libnxGen.cfg
Normal file
|
|
@ -0,0 +1,302 @@
|
|||
[n.global]
|
||||
output="src/libnx"
|
||||
c_compiler="aarch64-none-elf-gcc"
|
||||
cpp_compiler="aarch64-none-elf-g++"
|
||||
filter=lock
|
||||
|
||||
[n.include]
|
||||
src/libnx/nx/include
|
||||
src/libnx/nx/include/switch
|
||||
src/libnx/nx/include/switch/arm
|
||||
src/libnx/nx/include/switch/kernel
|
||||
src/libnx/nx/include/switch/services
|
||||
src/libnx/nx/include/switch/audio
|
||||
src/libnx/nx/include/switch/gfx
|
||||
src/libnx/nx/include/switch/runtime
|
||||
src/libnx/nx/include/switch/runtime/util
|
||||
src/libnx/nx/include/switch/runtime/devices
|
||||
/opt/devkitpro/devkitA64/aarch64-none-elf/include/
|
||||
|
||||
[n.exclude]
|
||||
src/libnx/nim.cfg
|
||||
|
||||
[n.prepare]
|
||||
gitremote = "https://github.com/switchbrew/libnx"
|
||||
gitsparse = """
|
||||
nx/include/*
|
||||
nx/source/*
|
||||
nx/external/bsd/*
|
||||
"""
|
||||
|
||||
[n.after]
|
||||
wildcard = ".nim"
|
||||
search = "_Bool"
|
||||
replace = "bool"
|
||||
|
||||
search.u8 = "u8"
|
||||
replace.u8 = "uint8"
|
||||
|
||||
search.u16 = "u16"
|
||||
replace.u16 = "uint16"
|
||||
|
||||
search.u32 = "u32"
|
||||
replace.u32 = "uint32"
|
||||
|
||||
search.u64 = "u64"
|
||||
replace.u64 = "uint64"
|
||||
|
||||
search.lib = " src/libnx"
|
||||
replace.lib = " libnx"
|
||||
|
||||
search.timport = "../types"
|
||||
replace.timport = "libnx/types"
|
||||
|
||||
search.kimport = "../kernel/"
|
||||
replace.kimport = "libnx/"
|
||||
|
||||
search.servimport = "../services/"
|
||||
replace.servimport = "libnx/"
|
||||
|
||||
search.resimport = "../result"
|
||||
replace.resimport = "libnx/result"
|
||||
|
||||
search.armimport = "../arm/"
|
||||
replace.armimport = "libnx/"
|
||||
|
||||
search.lock = "_LOCK"
|
||||
replace.lock = "LOCK"
|
||||
|
||||
search.cdecl = "stdcall"
|
||||
replace.cdecl = "cdecl"
|
||||
|
||||
[src/libnx/nim.cfg]
|
||||
create = """
|
||||
--path:"../"
|
||||
"""
|
||||
|
||||
[result.h]
|
||||
defines = true
|
||||
|
||||
[hid.h]
|
||||
defines = true
|
||||
search.static_assert = "static_assert"
|
||||
replace.static_assert = "// static_assert"
|
||||
|
||||
[ipc.h]
|
||||
defines = true
|
||||
execute = "vim -es +'g/^static inline.*{/norm f{d%r;' -es +%print -es +q! $file"
|
||||
|
||||
[tls.h]
|
||||
execute = "vim -es +'g/^static inline.*{/norm f{d%r;' -es +%print -es +q! $file"
|
||||
|
||||
[sm.h]
|
||||
execute = "vim -es +'g/^static inline.*{/norm f{d%r;' -es +%print -es +q! $file"
|
||||
|
||||
[shmem.h]
|
||||
execute = "vim -es +'g/^static inline.*{/norm f{d%r;' -es +%print -es +q! $file"
|
||||
|
||||
[condvar.h]
|
||||
execute = "vim -es +'g/^static inline.*/norm jd%$$a;' -es +%print -es +q! $file"
|
||||
|
||||
[romfs_dev.h]
|
||||
execute = "vim -es +'g/^static inline.*/norm jd%$$a;' -es +%print -es +q! $file"
|
||||
search = "romfs_"
|
||||
replace = "Romfs_"
|
||||
|
||||
[gfx.h]
|
||||
defines = true
|
||||
execute = "vim -es +'g/^static inline.*{/norm f{d%r;' -es +%print -es +q! $file"
|
||||
|
||||
[ioctl.h]
|
||||
defines = true
|
||||
search = "_NV_"
|
||||
replace = "UNV_"
|
||||
|
||||
search.nv = "__nv_"
|
||||
replace.nv = "DUnv_"
|
||||
|
||||
[svc.h]
|
||||
search = "PACKED"
|
||||
replace = ""
|
||||
|
||||
search.noreturn = "NORETURN"
|
||||
replace.noreturn = ""
|
||||
|
||||
defines=true
|
||||
execute = "vim -es +'g/^static inline.*{/norm f{d%r;' -es +%print -es +q! $file"
|
||||
|
||||
[switch.h]
|
||||
preprocess = true
|
||||
defines = true
|
||||
recurse = true
|
||||
compile = "src/libnx/nx/source"
|
||||
|
||||
[types.nim]
|
||||
search.o = " uint8*"
|
||||
prepend.o = """
|
||||
u8* = uint8
|
||||
u16* = uint16
|
||||
u32* = uint32
|
||||
u64* = uint64
|
||||
int8_t* = int8
|
||||
int16_t* = int16
|
||||
int32_t* = int32
|
||||
int64_t* = int64
|
||||
ssize_t* = int
|
||||
"""
|
||||
|
||||
search.s128 = " s128* = __int128_t"
|
||||
replace.s128 = ""
|
||||
|
||||
search.u128 = " u128* = __uint128_t"
|
||||
replace.u128 = ""
|
||||
|
||||
search.uint8 = "uint8* = uint8_t"
|
||||
replace.uint8 = "uint8_t* = uint8"
|
||||
|
||||
search.uint16 = "uint16* = uint16_t"
|
||||
replace.uint16 = "uint16_t* = uint16"
|
||||
|
||||
search.uint32 = "uint32* = uint32_t"
|
||||
replace.uint32 = "uint32_t* = uint32"
|
||||
|
||||
search.uint64 = "uint64* = uint64_t"
|
||||
replace.uint64 = "uint64_t* = uint64"
|
||||
|
||||
search.import = "type\n"
|
||||
prepend.import = """
|
||||
include integer128
|
||||
template BIT*(n): auto = (1.uint shl n)
|
||||
"""
|
||||
|
||||
[svc.nim]
|
||||
|
||||
search.import = "type\n"
|
||||
prepend.import = """
|
||||
import libnx/types
|
||||
"""
|
||||
|
||||
search.permx = "Perm_X = BIT(2), ## /< Execute permission."
|
||||
replace.permx = "Perm_Rw = Perm_R.int or Perm_W.int, ## /< Read/write permissions."
|
||||
|
||||
search.permrw = "Perm_Rw = Perm_R or Perm_W, ## /< Read/write permissions."
|
||||
replace.permrw = "Perm_X = BIT(2), ## /< Execute permission."
|
||||
|
||||
search.permrx = "Perm_Rx = Perm_R or Perm_X, ## /< Read/execute permissions."
|
||||
replace.permrx = "Perm_Rx = Perm_R.int or Perm_X.int, ## /< Read/execute permissions."
|
||||
|
||||
[shmem.nim]
|
||||
search.import = "type\n"
|
||||
prepend.import = """
|
||||
import libnx/svc
|
||||
"""
|
||||
|
||||
[nacp.nim]
|
||||
search.t = "type"
|
||||
prepend.t = """
|
||||
import libnx/types
|
||||
"""
|
||||
|
||||
[lock.nim]
|
||||
search.flock_t = " __lock_t"
|
||||
replace.flock_t = " DUlock_t"
|
||||
|
||||
search.nlock_t = "= __lock_t"
|
||||
replace.nlock_t = "= DUlock_t"
|
||||
|
||||
search.import = "type"
|
||||
prepend.import = """
|
||||
import libnx/types
|
||||
"""
|
||||
|
||||
search.proc_under = "proc __"
|
||||
replace.proc_under = "proc DU"
|
||||
|
||||
[ipc.nim]
|
||||
search.o = "UINT32_MAX"
|
||||
replace.o = "uint32.high"
|
||||
|
||||
search.import = "import\n"
|
||||
append.import = """
|
||||
libnx/types,
|
||||
"""
|
||||
|
||||
[audin.nim]
|
||||
search.o = "import "
|
||||
prepend.o = """
|
||||
import libnx/types
|
||||
"""
|
||||
|
||||
[audout.nim]
|
||||
search.o = "import "
|
||||
prepend.o = """
|
||||
import libnx/types
|
||||
"""
|
||||
|
||||
[hid.nim]
|
||||
search.o = """ KEY_JOYCON_RIGHT = BIT(0), KEY_JOYCON_DOWN = BIT(1), KEY_JOYCON_UP = BIT(2), KEY_JOYCON_LEFT = BIT(
|
||||
3),"""
|
||||
replace.o = ""
|
||||
|
||||
search.key_left = "KEY_LEFT = KEY_DLEFT or KEY_LSTICK_LEFT or KEY_RSTICK_LEFT, ## /< D-Pad Left or Sticks Left"
|
||||
replace.key_left = ""
|
||||
search.key_rstick_up = " KEY_RSTICK_UP"
|
||||
prepend.key_rstick_up = """
|
||||
KEY_LEFT = KEY_DLEFT.int or KEY_LSTICK_LEFT.int or KEY_RSTICK_LEFT.int, ## /< D-Pad Left or Sticks Left
|
||||
"""
|
||||
|
||||
search.key_right = " KEY_RIGHT = KEY_DRIGHT or KEY_LSTICK_RIGHT or KEY_RSTICK_RIGHT ## /< D-Pad Right or Sticks Right"
|
||||
replace.key_right = ""
|
||||
search.key_rstick_down = " KEY_RSTICK_DOWN"
|
||||
prepend.key_rstick_down = """
|
||||
KEY_RIGHT = KEY_DRIGHT.int or KEY_LSTICK_RIGHT.int or KEY_RSTICK_RIGHT.int ## /< D-Pad Right or Sticks Right
|
||||
"""
|
||||
|
||||
search.key_up = " KEY_UP = KEY_DUP or KEY_LSTICK_UP or KEY_RSTICK_UP, ## /< D-Pad Up or Sticks Up"
|
||||
replace.key_up = ""
|
||||
search.key_rstick_right = " KEY_RSTICK_RIGHT"
|
||||
prepend.key_rstick_right = """
|
||||
KEY_UP = KEY_DUP.int or KEY_LSTICK_UP.int or KEY_RSTICK_UP.int, ## /< D-Pad Up or Sticks Up
|
||||
"""
|
||||
|
||||
search.key_down = " KEY_DOWN = KEY_DDOWN or KEY_LSTICK_DOWN or KEY_RSTICK_DOWN, ## /< D-Pad Down or Sticks Down"
|
||||
replace.key_down = ""
|
||||
search.key_sl = " KEY_SL"
|
||||
prepend.key_sl = """
|
||||
KEY_DOWN = KEY_DDOWN.int or KEY_LSTICK_DOWN.int or KEY_RSTICK_DOWN.int, ## /< D-Pad Down or Sticks Down
|
||||
"""
|
||||
|
||||
[nifm.nim]
|
||||
search.o = "import libnx"
|
||||
prepend.o = """
|
||||
import libnx/types
|
||||
"""
|
||||
|
||||
[set.nim]
|
||||
search.o = "import libnx"
|
||||
prepend.o = """
|
||||
import libnx/types
|
||||
"""
|
||||
|
||||
[parcel.nim]
|
||||
search.o = "import libnx"
|
||||
prepend.o = """
|
||||
import libnx/types
|
||||
"""
|
||||
|
||||
[fs_dev.nim]
|
||||
search.o = "import libnx"
|
||||
prepend.o = """
|
||||
import libnx/types
|
||||
"""
|
||||
|
||||
[buffer_producer.nim]
|
||||
search.o = "import libnx"
|
||||
prepend.o = """
|
||||
import libnx/types
|
||||
import libnx/binder
|
||||
"""
|
||||
|
||||
[nxlink.nim]
|
||||
search.o = "var __nxlink"
|
||||
replace.o = "var DUnxlink"
|
||||
Loading…
Add table
Add a link
Reference in a new issue