diff --git a/Zenitha b/Zenitha index 5aae4d13..f3108ec2 160000 --- a/Zenitha +++ b/Zenitha @@ -1 +1 @@ -Subproject commit 5aae4d13f644f9dbdc8b312970f5a436adc58d9a +Subproject commit f3108ec20127c088588b5698746f72284ce132a5 diff --git a/assets/fmod20221/cdef.lua b/assets/fmod20221/cdef.lua index 4c01efcd..fd7b80ee 100644 --- a/assets/fmod20221/cdef.lua +++ b/assets/fmod20221/cdef.lua @@ -1,4 +1,4 @@ -require("ffi").cdef[[ +require'ffi'.cdef[[ typedef int FMOD_BOOL; typedef struct FMOD_SYSTEM FMOD_SYSTEM; typedef struct FMOD_SOUND FMOD_SOUND; diff --git a/assets/fmod20221/constants.lua b/assets/fmod20221/constants.lua index bdbe6015..e190358c 100644 --- a/assets/fmod20221/constants.lua +++ b/assets/fmod20221/constants.lua @@ -1,9 +1,9 @@ -local bit=require("bit") -local ffi=require("ffi") +local bit=require'bit' +local ffi=require'ffi' local require=simpRequire(((...):gsub("[^%.]*$", ""))) ---@class FMOD.Master -local M=require("master") +local M=require'master' M.FMOD_VERSION=0x00020221 M.FMOD_DEBUG_LEVEL_NONE=0x00000000 diff --git a/assets/fmod20221/enums.lua b/assets/fmod20221/enums.lua index da16e1db..cbd84e9b 100644 --- a/assets/fmod20221/enums.lua +++ b/assets/fmod20221/enums.lua @@ -1,7 +1,7 @@ local require=simpRequire(((...):gsub("[^%.]*$", ""))) ---@class FMOD.Master -local M=require("master") +local M=require'master' local C=M.C M.FMOD_THREAD_TYPE_MIXER=C.FMOD_THREAD_TYPE_MIXER diff --git a/assets/fmod20221/errors.lua b/assets/fmod20221/errors.lua index 60e80395..e29cf27f 100644 --- a/assets/fmod20221/errors.lua +++ b/assets/fmod20221/errors.lua @@ -1,7 +1,7 @@ local require=simpRequire(((...):gsub("[^%.]*$", ""))) ---@class FMOD.Master -local M=require("master") +local M=require'master' M.errorString=setmetatable({ [M.FMOD_OK]="No errors.", diff --git a/assets/fmod20221/init.lua b/assets/fmod20221/init.lua index 0692cae2..f55c391f 100644 --- a/assets/fmod20221/init.lua +++ b/assets/fmod20221/init.lua @@ -1,26 +1,45 @@ -local ffi=require("ffi") +local ffi=require'ffi' local require=simpRequire(((...):gsub(".init$","")..".")) -require("cdef") +require'cdef' ---@class FMOD.Master -local M=require("master") - --- search for fmod shared libraries in package.cpath -local fmodPath=package.searchpath("fmod",package.cpath) -local fmodstudioPath=package.searchpath("fmodstudio",package.cpath) - -if fmodPath and fmodstudioPath then - -- pretend to load libfmod through Lua (it's going to fail but not raise any errors) so that its location is known when loading libfmodstudio through ffi - -- package.loadlib(fmodPath,"") - M.C=ffi.load(fmodPath) - M.C2=ffi.load(fmodstudioPath) - require("enums") - require("constants") - require("wrap") - require("errors") +local M=require'master' + +if SYSTEM=='Android' then + local platform='armeabi-v7a' + local p=io.popen('uname -m') + if p then + local arch=p:read('*a'):lower() + p:close() + if arch:find('v8') or arch:find('64') then + platform='arm64-v8a' + elseif arch:find('x86_64') then + platform='x86_64' + elseif arch:find('x86') then + platform='x86' + end + end + love.filesystem.write('lib/libfmod.so',love.filesystem.read('data','libAndroid/fmod/'..platform..'/libfmod.so')) + love.filesystem.write('lib/libfmodstudio.so',love.filesystem.read('data','libAndroid/fmod/'..platform..'/libfmodstudio.so')) + M.C=ffi.load(love.filesystem.getSaveDirectory()..'/lib/libfmod.so') + M.C2=ffi.load(love.filesystem.getSaveDirectory()..'/lib/libfmodstudio.so') else - MSG.new('error',"FMOD shared libraries not found!") + -- search for fmod shared libraries in package.cpath + local fmodPath=package.searchpath('fmod',package.cpath) + local fmodstudioPath=package.searchpath('fmodstudio',package.cpath) + if fmodPath and fmodstudioPath then + -- pretend to load libfmod through Lua (it's going to fail but not raise any errors) so that its location is known when loading libfmodstudio through ffi + -- package.loadlib(fmodPath,"") + M.C=ffi.load(fmodPath) + M.C2=ffi.load(fmodstudioPath) + require'enums' + require'constants' + require'wrap' + require'errors' + else + MSG.new('error',"FMOD shared libraries not found!") + end end diff --git a/assets/fmod20221/wrap.lua b/assets/fmod20221/wrap.lua index 69adb546..5e80486b 100644 --- a/assets/fmod20221/wrap.lua +++ b/assets/fmod20221/wrap.lua @@ -1,4 +1,4 @@ -local ffi=require("ffi") +local ffi=require'ffi' local require=simpRequire(((...):gsub("[^%.]*$", ""))) ---@alias FMOD.GUID FMOD.GUID @@ -7,7 +7,7 @@ local require=simpRequire(((...):gsub("[^%.]*$", ""))) ---@alias FMOD.Enum FMOD.Enum ---@class FMOD.Master -local M=require("master") +local M=require'master' local C=M.C local C2=M.C2 diff --git a/assets/scene/dictionary.lua b/assets/scene/dictionary.lua index 7c7c843e..cba5c93a 100644 --- a/assets/scene/dictionary.lua +++ b/assets/scene/dictionary.lua @@ -31,7 +31,7 @@ local contents={ } -- Base dict data, not formatted local baseDict do - baseDict=require('assets/dict_base') + baseDict=require'assets/dict_base' local dictObjMeta={__index=function(obj,k) if k=='titleText' then obj.titleText=GC.newText(FONT.get(obj.titleSize,'bold'),obj.titleFull) diff --git a/conf.lua b/conf.lua index 056ee3f9..1e7e95d5 100644 --- a/conf.lua +++ b/conf.lua @@ -51,7 +51,7 @@ function love.conf(t) W.width,W.height=1440,900 W.minwidth,W.minheight=288,180 end - W.title=require"version".appName.." "..require"version".appVer + W.title=require'version'.appName.." "..require'version'.appVer if fs.getInfo('assets/image/icon.png') then W.icon='assets/image/icon.png' diff --git a/main.lua b/main.lua index 37de8678..5e8ab60b 100644 --- a/main.lua +++ b/main.lua @@ -25,7 +25,7 @@ ------------------------------------------------------------- -- Load Zenitha -require("Zenitha") +require'Zenitha' DEBUG.checkLoadTime("Load Zenitha") -- DEBUG.runVarMonitor() -- DEBUG.setCollectGarvageVisible() @@ -37,7 +37,7 @@ STRING.install() math.randomseed(os.time()*626) love.setDeprecationOutput(false) love.keyboard.setTextInput(false) -VERSION=require"version" +VERSION=require'version' -------------------------------------------------------------- -- Create directories