From 2d02df6d83cf217c5c0e94169f8fafe4c2c5c9fb Mon Sep 17 00:00:00 2001 From: Ronny Otto Date: Mon, 5 Sep 2016 00:23:43 +0200 Subject: [PATCH] v0.3.4.3 --- source/Dig/base.util.graphicsmanager.bmx | 15 +- .../reflectionExtended/callmethod.macos.x86.s | 2 +- .../reflectionExtended/reflection.bmx | 129 +++++++++++++----- source/main.bmx | 2 +- 4 files changed, 104 insertions(+), 44 deletions(-) diff --git a/source/Dig/base.util.graphicsmanager.bmx b/source/Dig/base.util.graphicsmanager.bmx index 8ff4cb8f6..5d4795842 100644 --- a/source/Dig/base.util.graphicsmanager.bmx +++ b/source/Dig/base.util.graphicsmanager.bmx @@ -36,9 +36,6 @@ Rem EndRem SuperStrict Import brl.Graphics -?android -Import sdl.gl2sdlmax2d -? ?MacOs Import BRL.GLMax2D ?Win32 @@ -48,6 +45,10 @@ Import "base.util.graphicsmanager.win32.bmx" Import BRL.GLMax2D 'Import "../source/external/bufferedglmax2d/bufferedglmax2d.bmx" ? +?bmxng +'?android +Import sdl.gl2sdlmax2d +? Import "base.util.virtualgraphics.bmx" Import "base.util.logger.bmx" @@ -259,12 +260,14 @@ Type TGraphicsManager Method _InitGraphicsDefault:Int() Select renderer 'buffered gl? - ?android + '?android + ?bmxng Default TLogger.Log("GraphicsManager.InitGraphics()", "SetGraphicsDriver ~qGL2SDL~q.", LOG_DEBUG) SetGraphicsDriver GL2Max2DDriver() renderer = RENDERER_GL2SDL - ?Not android + '?Not android + ?not bmxng Default TLogger.Log("GraphicsManager.InitGraphics()", "SetGraphicsDriver ~qOpenGL~q.", LOG_DEBUG) SetGraphicsDriver GLMax2DDriver() @@ -334,7 +337,7 @@ Type TGraphicsManager Method EnableSmoothLines:Int() - If renderer = RENDERER_OPENGL Or renderer = RENDERER_BUFFEREDOPENGL + If renderer = RENDERER_OPENGL or renderer = RENDERER_GL2SDL Or renderer = RENDERER_BUFFEREDOPENGL ?Not android GlEnable(GL_LINE_SMOOTH) ? diff --git a/source/Dig/external/reflectionExtended/callmethod.macos.x86.s b/source/Dig/external/reflectionExtended/callmethod.macos.x86.s index 2ad07bf11..41cc27d16 100755 --- a/source/Dig/external/reflectionExtended/callmethod.macos.x86.s +++ b/source/Dig/external/reflectionExtended/callmethod.macos.x86.s @@ -1 +1 @@ - .globl _bbCallMethod _memcpy .text _bbCallMethod: push %ebp mov %esp, %ebp sub 16(%ebp), %esp push 16(%ebp) push 12(%ebp) push %esp call _memcpy add 4, %esp call *8(%ebp) mov %ebp, %esp pop %ebp ret \ No newline at end of file + .globl _bbCallMethod .text _bbCallMethod: pushl %ebp movl %esp,%ebp subl 0x10(%ebp),%esp pushl 0x10(%ebp) pushl 0xc(%ebp) pushl %esp calll _memcpy addl $0x4,%esp calll *0x8(%ebp) movl %ebp,%esp popl %ebp ret \ No newline at end of file diff --git a/source/Dig/external/reflectionExtended/reflection.bmx b/source/Dig/external/reflectionExtended/reflection.bmx index 71c91b4ef..0a38a8ab5 100644 --- a/source/Dig/external/reflectionExtended/reflection.bmx +++ b/source/Dig/external/reflectionExtended/reflection.bmx @@ -43,13 +43,17 @@ bbdoc: BASIC/Reflection Module BRL.Reflection -ModuleInfo "Version: 1.26" +ModuleInfo "Version: 1.28" ModuleInfo "Author: Mark Sibly" ModuleInfo "License: zlib/libpng" ModuleInfo "Copyright: Blitz Research Ltd" ModuleInfo "Modserver: BRL" -ModuleInfo "History: 1.26 [grable]" +ModuleInfo "History: 1.28 [grable]" +ModuleInfo "History: Reverted back to old _Call() before assembly (max 8 arguments) for MacOSX" +ModuleInfo "History: 1.27 [Derron]" +ModuleInfo "History: Fixed MacOSX assembly not compiling" +ModuleInfo "History: 1.26 [Derron]" ModuleInfo "History: Fixed TFunction.FunctionPtr() accessing supertype of Null" ModuleInfo "History: 1.25 [grable]" ModuleInfo "History: Fixed linux version of bbCallMethod" @@ -122,12 +126,17 @@ Import "callmethod.linux.x86.s" ?Win32 Import "callmethod.win32.x86.s" ?MacOS -Import "callmethod.macos.x86.s" +' disabled until i can figure out what special voodoo macs require +'Import "callmethod.macos.x86.s" ? Private -Const MAX_CALL_ARGS:Int = 30 ' original=8 +?MacOS +Const MAX_CALL_ARGS:Int = 8 +?Not MacOS +Const MAX_CALL_ARGS:Int = 30 +? Extern @@ -159,11 +168,12 @@ Function bbRefAssignObject( p:Byte Ptr,obj:Object ) Function bbRefGetObjectClass( obj:Object ) Function bbRefGetSuperClass( class ) +?Not MacOS Function bbCallMethod:Int( p:Byte Ptr, args:Byte Ptr, sz:Int) Function bbCallMethod_Float:Float( p:Byte Ptr, args:Byte Ptr, sz:Int) = "bbCallMethod" Function bbCallMethod_Object:Object( p:Byte Ptr, args:Byte Ptr, sz:Int) = "bbCallMethod" Function bbCallMethod_Double:Double( p:Byte Ptr, args:Byte Ptr, sz:Int) = "bbCallMethod" - +? End Extern Type TClass @@ -244,7 +254,7 @@ Function _Push:Byte Ptr( sp:Byte Ptr,typeId:TTypeId,value:Object ) While t And t<>c t=bbRefGetSuperClass( t ) Wend - If Not t Throw "ERROR" + If Not t Throw "_Push() ERROR" EndIf bbRefPushObject sp,value Return sp+4 @@ -292,15 +302,79 @@ Function _Assign( p:Byte Ptr,typeId:TTypeId,value:Object ) While t And t<>c t=bbRefGetSuperClass( t ) Wend - If Not t Throw "ERROR" + If Not t Throw "_Assign() ERROR" EndIf bbRefAssignObject p,value End Select End Function +' +' bmx fallback path for calling methods. for macos +' +?MacOS Function _Call:Object( callableP:Byte Ptr, retTypeId:TTypeId, obj:Object=Null, args:Object[], argtypes:TTypeId[]) + Assert args.Length = argtypes.Length + Local q:Int[MAX_CALL_ARGS + 2], sp:Byte Ptr = q + + If obj 'method call of an instance + bbRefPushObject sp,obj + sp:+4 + EndIf + + Local lret:Long + If retTypeId = LongTypeId Then + Byte Ptr Ptr(sp)[0] = Byte Ptr Varptr lret + sp :+ 4 + EndIf + For Local i:Int = 0 Until args.Length + If Int Ptr(sp) >= Int Ptr(q)+MAX_CALL_ARGS Then Throw "_Call() ERROR: Exceeded max args #1" + sp = _Push( sp, argtypes[i], args[i]) + Next + If Int Ptr(sp) > Int Ptr(q)+MAX_CALL_ARGS Then Throw "_Call() ERROR: Exceeded max args #2" + + Select retTypeId + Case ByteTypeId, ShortTypeId, IntTypeId + Local f(p0, p1, p2, p3, p4, p5, p6, p7) = callableP + Return String.FromInt( f( q[0],q[1],q[2],q[3],q[4],q[5],q[6],q[7] ) ) + Case LongTypeId + Local r:Long + If obj Then + Local f( p0, r:Long Var, p1,p2,p3,p4,p5,p6,p7) = callableP + f( q[0], r, q[1],q[2],q[3],q[4],q[5],q[6],q[7] ) + Else + Local f( r:Long Var, p0, p1,p2,p3,p4,p5,p6,p7) = callableP + f( r, q[0], q[1],q[2],q[3],q[4],q[5],q[6],q[7] ) + EndIf + Return String.FromLong(r) + Case FloatTypeId + Local f:Float(p0, p1, p2, p3, p4, p5, p6, p7) = callableP + Return String.FromFloat( f( q[0],q[1],q[2],q[3],q[4],q[5],q[6],q[7] ) ) + Case DoubleTypeId + Local f:Double(p0, p1, p2, p3, p4, p5, p6, p7) = callableP + Return String.FromDouble( f( q[0],q[1],q[2],q[3],q[4],q[5],q[6],q[7] ) ) + Default + If retTypeId.ExtendsType(PointerTypeId) Or retTypeId.ExtendsType(FunctionTypeId) Then + Local f:Int(p0, p1, p2, p3, p4, p5, p6, p7) = callableP + Return String.FromInt( f( q[0],q[1],q[2],q[3],q[4],q[5],q[6],q[7] ) ) + Else + Local f:Object(p0, p1, p2, p3, p4, p5, p6, p7) = callableP + Return f( q[0],q[1],q[2],q[3],q[4],q[5],q[6],q[7] ) + EndIf + End Select +End Function +? + +' +' asembly path for calling methods. for linux and win32 +' +?Not MacOS +Function _Call:Object( callableP:Byte Ptr, retTypeId:TTypeId, obj:Object=Null, args:Object[], argtypes:TTypeId[]) + Assert args.Length = argtypes.Length + + Local q:Int[MAX_CALL_ARGS + 2], sp:Byte Ptr = q + If obj 'method call of an instance bbRefPushObject sp,obj sp:+4 @@ -313,47 +387,31 @@ Function _Call:Object( callableP:Byte Ptr, retTypeId:TTypeId, obj:Object=Null, a EndIf For Local i:Int = 0 Until args.Length - If Int Ptr(sp) >= Int Ptr(q)+MAX_CALL_ARGS Then Throw "ERROR" + If Int Ptr(sp) >= Int Ptr(q)+MAX_CALL_ARGS Then Throw "_Call() ERROR: Exceeded max args #1" sp = _Push( sp, argtypes[i], args[i]) Next - If Int Ptr(sp) > Int Ptr(q)+MAX_CALL_ARGS Then Throw "ERROR" + If Int Ptr(sp) > Int Ptr(q)+MAX_CALL_ARGS Then Throw "_Call() ERROR: Exceeded max args #2" + + Local size:Int = sp - Byte Ptr q Select retTypeId Case ByteTypeId, ShortTypeId, IntTypeId -' Local f(p0, p1, p2, p3, p4, p5, p6, p7) = callableP -' Return String.FromInt( f( q[0],q[1],q[2],q[3],q[4],q[5],q[6],q[7] ) ) - Return String.FromInt( bbCallMethod( callableP, q, sp - Byte Ptr q) ) + Return String.FromInt( bbCallMethod( callableP, q, size) ) Case LongTypeId -' Local r:Long -' If obj Then -' Local f( p0, r:Long Var, p1,p2,p3,p4,p5,p6,p7) = callableP -' f( q[0], r, q[1],q[2],q[3],q[4],q[5],q[6],q[7] ) -' Else -' Local f( r:Long Var, p0, p1,p2,p3,p4,p5,p6,p7) = callableP -' f( r, q[0], q[1],q[2],q[3],q[4],q[5],q[6],q[7] ) -' EndIf -' Return String.FromLong(r) - bbCallMethod( callableP, q, sp - Byte Ptr q) + bbCallMethod( callableP, q, size) Return String.FromInt( lret ) Case FloatTypeId -' Local f:Float(p0, p1, p2, p3, p4, p5, p6, p7) = callableP -' Return String.FromFloat( f( q[0],q[1],q[2],q[3],q[4],q[5],q[6],q[7] ) ) - Return String.FromFloat( bbCallMethod_Float( callableP, q, sp - Byte Ptr q) ) + Return String.FromFloat( bbCallMethod_Float( callableP, q, size) ) Case DoubleTypeId -' Local f:Double(p0, p1, p2, p3, p4, p5, p6, p7) = callableP -' Return String.FromDouble( f( q[0],q[1],q[2],q[3],q[4],q[5],q[6],q[7] ) ) - Return String.FromDouble( bbCallMethod_Double( callableP, q, sp - Byte Ptr q) ) + Return String.FromDouble( bbCallMethod_Double( callableP, q, size) ) Default If retTypeId.ExtendsType(PointerTypeId) Or retTypeId.ExtendsType(FunctionTypeId) Then -' Local f:Int(p0, p1, p2, p3, p4, p5, p6, p7) = callableP -' Return String.FromInt( f( q[0],q[1],q[2],q[3],q[4],q[5],q[6],q[7] ) ) - Return String.FromInt( bbCallMethod( callableP, q, sp - Byte Ptr q) ) + Return String.FromInt( bbCallMethod( callableP, q, size) ) Else -' Local f:Object(p0, p1, p2, p3, p4, p5, p6, p7) = callableP -' Return f( q[0],q[1],q[2],q[3],q[4],q[5],q[6],q[7] ) - Return bbCallMethod_Object( callableP, q, sp - Byte Ptr q) + Return bbCallMethod_Object( callableP, q, size) EndIf End Select End Function +? Function TypeTagForId$( id:TTypeId ) If id.ExtendsType( ArrayTypeId ) @@ -1485,5 +1543,4 @@ EndRem Global _count,_nameMap:TMap=New TMap,_classMap:TMap=New TMap -End Type - +End Type \ No newline at end of file diff --git a/source/main.bmx b/source/main.bmx index 691a3392f..3f8d52633 100644 --- a/source/main.bmx +++ b/source/main.bmx @@ -126,7 +126,7 @@ Include "game.escapemenu.bmx" '===== Globals ===== VersionDate = LoadText("incbin::source/version.txt").Trim() -VersionString = "v0.3.4.2 Build ~q" + VersionDate+"~q" +VersionString = "v0.3.4.3 Build ~q" + VersionDate+"~q" CopyrightString = "by Ronny Otto & Team" Global APP_NAME:string = "TVTower"