Rename rlib to rreslib
This commit is contained in:
parent
020ab54435
commit
275bcd3efc
7 changed files with 21 additions and 21 deletions
|
@ -8,7 +8,7 @@ import (
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
"github.com/gen2brain/raylib-go/rres"
|
"github.com/gen2brain/raylib-go/rres"
|
||||||
"github.com/gen2brain/raylib-go/rres/rlib"
|
"github.com/gen2brain/raylib-go/rres/rreslib"
|
||||||
)
|
)
|
||||||
|
|
||||||
// LoadResource - Load resource from file by id
|
// LoadResource - Load resource from file by id
|
||||||
|
@ -57,13 +57,13 @@ func LoadResource(reader io.ReadSeeker, rresID int, key []byte) (data rres.Data)
|
||||||
reader.Read(b)
|
reader.Read(b)
|
||||||
|
|
||||||
// Decompress data
|
// Decompress data
|
||||||
data.Data, err = rlib.Decompress(b, int(infoHeader.CompType))
|
data.Data, err = rreslib.Decompress(b, int(infoHeader.CompType))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
TraceLog(LogWarning, "[ID %d] %v", infoHeader.ID, err)
|
TraceLog(LogWarning, "[ID %d] %v", infoHeader.ID, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decrypt data
|
// Decrypt data
|
||||||
data.Data, err = rlib.Decrypt(key, data.Data, int(infoHeader.CryptoType))
|
data.Data, err = rreslib.Decrypt(key, data.Data, int(infoHeader.CryptoType))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
TraceLog(LogWarning, "[ID %d] %v", infoHeader.ID, err)
|
TraceLog(LogWarning, "[ID %d] %v", infoHeader.ID, err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ import (
|
||||||
"github.com/moutend/go-wav"
|
"github.com/moutend/go-wav"
|
||||||
|
|
||||||
"github.com/gen2brain/raylib-go/rres"
|
"github.com/gen2brain/raylib-go/rres"
|
||||||
"github.com/gen2brain/raylib-go/rres/rlib"
|
"github.com/gen2brain/raylib-go/rres/rreslib"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -156,7 +156,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encryption
|
// Encryption
|
||||||
data, err = rlib.Encrypt([]byte(*key), data, int(infoHeader.CryptoType))
|
data, err = rreslib.Encrypt([]byte(*key), data, int(infoHeader.CryptoType))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("%v\n", err)
|
fmt.Printf("%v\n", err)
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ func main() {
|
||||||
infoHeader.UncompSize = uint32(len(data))
|
infoHeader.UncompSize = uint32(len(data))
|
||||||
|
|
||||||
// Compression
|
// Compression
|
||||||
data, err = rlib.Compress(data, int(infoHeader.CompType))
|
data, err = rreslib.Compress(data, int(infoHeader.CompType))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("%v\n", err)
|
fmt.Printf("%v\n", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
all: build
|
|
||||||
|
|
||||||
build:
|
|
||||||
go build -buildmode=c-archive -o rlib.a
|
|
4
rres/rreslib/cgo/Makefile
Normal file
4
rres/rreslib/cgo/Makefile
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
all: build
|
||||||
|
|
||||||
|
build:
|
||||||
|
go build -buildmode=c-archive -o rreslib.a
|
|
@ -5,14 +5,14 @@ MINGW="/usr/i686-w64-mingw32"
|
||||||
RPI="/usr/armv6j-hardfloat-linux-gnueabi"
|
RPI="/usr/armv6j-hardfloat-linux-gnueabi"
|
||||||
ANDROID="/opt/android-toolchain-arm7"
|
ANDROID="/opt/android-toolchain-arm7"
|
||||||
|
|
||||||
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -buildmode=c-archive -o release/linux/rlib.a -ldflags "-s -w"
|
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -buildmode=c-archive -o release/linux/rreslib.a -ldflags "-s -w"
|
||||||
|
|
||||||
CC="i686-w64-mingw32-gcc" CXX="i686-w64-mingw32-g++" \
|
CC="i686-w64-mingw32-gcc" CXX="i686-w64-mingw32-g++" \
|
||||||
CGO_ENABLED=1 GOOS=windows GOARCH=386 go build -buildmode=c-archive -o release/win32/rlib.a -ldflags "-s -w"
|
CGO_ENABLED=1 GOOS=windows GOARCH=386 go build -buildmode=c-archive -o release/win32/rreslib.a -ldflags "-s -w"
|
||||||
|
|
||||||
CC="armv6j-hardfloat-linux-gnueabi-gcc" CXX="armv6j-hardfloat-linux-gnueabi-g++" \
|
CC="armv6j-hardfloat-linux-gnueabi-gcc" CXX="armv6j-hardfloat-linux-gnueabi-g++" \
|
||||||
CGO_ENABLED=1 GOOS=linux GOARCH=arm go build -buildmode=c-archive -o release/rpi/rlib.a -ldflags "-s -w"
|
CGO_ENABLED=1 GOOS=linux GOARCH=arm go build -buildmode=c-archive -o release/rpi/rreslib.a -ldflags "-s -w"
|
||||||
|
|
||||||
PATH="$PATH:$ANDROID/bin" \
|
PATH="$PATH:$ANDROID/bin" \
|
||||||
CC="arm-linux-androideabi-gcc" CXX="arm-linux-androideabi-g++" \
|
CC="arm-linux-androideabi-gcc" CXX="arm-linux-androideabi-g++" \
|
||||||
CGO_ENABLED=1 GOOS=android GOARCH=arm go build -buildmode=c-shared -o release/android/armeabi-v7a/rlib.so -ldflags "-s -w"
|
CGO_ENABLED=1 GOOS=android GOARCH=arm go build -buildmode=c-shared -o release/android/armeabi-v7a/rreslib.so -ldflags "-s -w"
|
|
@ -5,14 +5,14 @@ import "C"
|
||||||
import (
|
import (
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
"github.com/gen2brain/raylib-go/rres/rlib"
|
"github.com/gen2brain/raylib-go/rres/rreslib"
|
||||||
)
|
)
|
||||||
|
|
||||||
//export Compress
|
//export Compress
|
||||||
func Compress(compType C.int, data *C.uchar, uncompSize C.ulong, outCompSize *C.ulong) *C.uchar {
|
func Compress(compType C.int, data *C.uchar, uncompSize C.ulong, outCompSize *C.ulong) *C.uchar {
|
||||||
d := C.GoBytes(unsafe.Pointer(data), C.int(uncompSize))
|
d := C.GoBytes(unsafe.Pointer(data), C.int(uncompSize))
|
||||||
|
|
||||||
c, err := rlib.Compress(d, int(compType))
|
c, err := rreslib.Compress(d, int(compType))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ func Compress(compType C.int, data *C.uchar, uncompSize C.ulong, outCompSize *C.
|
||||||
func Decompress(compType C.int, data *C.uchar, uncompSize C.ulong, compSize C.ulong) *C.uchar {
|
func Decompress(compType C.int, data *C.uchar, uncompSize C.ulong, compSize C.ulong) *C.uchar {
|
||||||
d := C.GoBytes(unsafe.Pointer(data), C.int(compSize))
|
d := C.GoBytes(unsafe.Pointer(data), C.int(compSize))
|
||||||
|
|
||||||
c, err := rlib.Decompress(d, int(compType))
|
c, err := rreslib.Decompress(d, int(compType))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ func Encrypt(cryptoType C.int, key *C.char, data *C.uchar, dataSize C.ulong, out
|
||||||
k := []byte(C.GoString(key))
|
k := []byte(C.GoString(key))
|
||||||
d := C.GoBytes(unsafe.Pointer(data), C.int(dataSize))
|
d := C.GoBytes(unsafe.Pointer(data), C.int(dataSize))
|
||||||
|
|
||||||
c, err := rlib.Encrypt(k, d, int(cryptoType))
|
c, err := rreslib.Encrypt(k, d, int(cryptoType))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ func Decrypt(cryptoType C.int, key *C.char, data *C.uchar, dataSize C.ulong) *C.
|
||||||
k := []byte(C.GoString(key))
|
k := []byte(C.GoString(key))
|
||||||
d := C.GoBytes(unsafe.Pointer(data), C.int(dataSize))
|
d := C.GoBytes(unsafe.Pointer(data), C.int(dataSize))
|
||||||
|
|
||||||
c, err := rlib.Decrypt(k, d, int(cryptoType))
|
c, err := rreslib.Decrypt(k, d, int(cryptoType))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
// Package rlib provides Encrypt/Decrypt and Compress/Uncompress functions
|
// Package rreslib provides Encrypt/Decrypt and Compress/Uncompress functions
|
||||||
package rlib
|
package rreslib
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
Loading…
Add table
Add a link
Reference in a new issue