Merge pull request #22 from Gompyn/AndroidCC

CC for Android(and Linux)
This commit is contained in:
MrZ_26
2020-08-22 15:58:37 +08:00
committed by GitHub
7 changed files with 38 additions and 8 deletions

View File

@@ -33,7 +33,7 @@ return{
} }
PLY.newPlayer(1,340,15) PLY.newPlayer(1,340,15)
local L={}for i=1,49 do L[i]=true end local L={}for i=1,49 do L[i]=true end
local t=system~="Windows"and 0 or 2 local t=CCloader_filename[system] and 0 or 2
while t>0 do while t>0 do
local r=rnd(2,49) local r=rnd(2,49)
if L[r]then L[r],t=false,t-1 end if L[r]then L[r],t=false,t-1 end

View File

@@ -33,7 +33,7 @@ return{
} }
PLY.newPlayer(1,340,15) PLY.newPlayer(1,340,15)
local L={}for i=1,49 do L[i]=true end local L={}for i=1,49 do L[i]=true end
local t=system~="Windows"and 0 or 4 local t=CCloader_filename[system] and 0 or 4
while t>0 do while t>0 do
local r=rnd(2,49) local r=rnd(2,49)
if L[r]then L[r],t=false,t-1 end if L[r]then L[r],t=false,t-1 end

View File

@@ -33,7 +33,7 @@ return{
} }
PLY.newPlayer(1,340,15) PLY.newPlayer(1,340,15)
local L={}for i=1,49 do L[i]=true end local L={}for i=1,49 do L[i]=true end
local t=system~="Windows"and 0 or 6 local t=CCloader_filename[system] and 0 or 6
while t>0 do while t>0 do
local r=rnd(2,49) local r=rnd(2,49)
if L[r]then L[r],t=false,t-1 end if L[r]then L[r],t=false,t-1 end

View File

@@ -33,7 +33,7 @@ return{
} }
PLY.newPlayer(1,340,15) PLY.newPlayer(1,340,15)
local L={}for i=1,100 do L[i]=true end local L={}for i=1,100 do L[i]=true end
local t=system~="Windows"and 0 or 4 local t=CCloader_filename[system] and 0 or 4
while t>0 do while t>0 do
local r=rnd(2,99) local r=rnd(2,99)
if L[r]then L[r],t=false,t-1 end if L[r]then L[r],t=false,t-1 end

View File

@@ -33,7 +33,7 @@ return{
} }
PLY.newPlayer(1,340,15) PLY.newPlayer(1,340,15)
local L={}for i=1,100 do L[i]=true end local L={}for i=1,100 do L[i]=true end
local t=system~="Windows"and 0 or 4 local t=CCloader_filename[system] and 0 or 4
while t>0 do while t>0 do
local r=rnd(2,99) local r=rnd(2,99)
if L[r]then L[r],t=false,t-1 end if L[r]then L[r],t=false,t-1 end

View File

@@ -33,7 +33,7 @@ return{
} }
PLY.newPlayer(1,340,15) PLY.newPlayer(1,340,15)
local L={}for i=1,100 do L[i]=true end local L={}for i=1,100 do L[i]=true end
local t=system~="Windows"and 0 or 4 local t=CCloader_filename[system] and 0 or 4
while t>0 do while t>0 do
local r=rnd(2,99) local r=rnd(2,99)
if L[r]then L[r],t=false,t-1 end if L[r]then L[r],t=false,t-1 end

View File

@@ -19,8 +19,37 @@ local blockPos={4,4,4,4,4,5,4}
local scs={{0,1},{0,1},{0,1},{0,1},{0,1},{.5,.5},{-.5,1.5}} local scs={{0,1},{0,1},{0,1},{0,1},{0,1},{.5,.5},{-.5,1.5}}
-------------------------------------------------Cold clear -------------------------------------------------Cold clear
local CCblockID={6,5,4,3,2,1,0} local CCblockID={6,5,4,3,2,1,0}
if system=="Windows"then CCloader_filename = {}
require("CCloader") CCloader_filename.Windows = {'CCloader.dll', '\\', {'x86_64'}}
CCloader_filename.Android = {'libCCloader.so', '/', {'arm64-v8a', 'armeabi-v7a'}}
CCloader_filename.Linux = {'libCCloader.so', '/', {'x86_64'}}
local function loadCC()
if not CCloader_filename[system] then return end
local concatter = CCloader_filename[system][2]
local function path_concat(paths)
local res = paths[1]
for i=2,#paths do
res = res .. concatter .. paths[i]
end
return res
end
local f
for i=1,#CCloader_filename[system][3] do
local function simulate_continue()
local CCloader_f, size = love.filesystem.read('data', path_concat({'lib', system, CCloader_filename[system][3][i], CCloader_filename[system][1]}))
if not CCloader_f then return end
local success, message = love.filesystem.write(CCloader_filename[system][1], CCloader_f, size)
if not success then return end
return package.loadlib(path_concat({love.filesystem.getSaveDirectory(), CCloader_filename[system][1]}), "luaopen_CCloader")
end
f = simulate_continue()
if f then break end
end
if not f then
CCloader_filename[system] = nil
return
end
f()
BOT={ BOT={
getConf= cc.get_default_config ,--()options,weights getConf= cc.get_default_config ,--()options,weights
--setConf= cc.set_options ,--(options,hold,20g,bag7) --setConf= cc.set_options ,--(options,hold,20g,bag7)
@@ -80,6 +109,7 @@ if system=="Windows"then
collectgarbage() collectgarbage()
end end
end end
loadCC()
-------------------------------------------------9 Stack setup -------------------------------------------------9 Stack setup
local dirCount={1,1,3,3,3,0,1} local dirCount={1,1,3,3,3,0,1}
local spinOffset={ local spinOffset={