Solved TLB miss by changing bytes() to bytes("", "UTF-16")

This commit is contained in:
attilavs2 2023-08-19 15:34:26 +02:00
parent ea3ffd8fe3
commit 5b74a5e4b9
2 changed files with 10 additions and 8 deletions

View file

@ -7,8 +7,7 @@ import os
def convert(input, output, params, target): def convert(input, output, params, target):
if params["custom-type"] == "map": if params["custom-type"] == "map":
#convert_map(input, output, params, target) print("ERROR : Asset ", params["name"], " has legacy type map")
#return 0
return 1 return 1
elif params["custom-type"] == "world": elif params["custom-type"] == "world":
convert_world(input, output, params, target) convert_world(input, output, params, target)
@ -209,7 +208,6 @@ def get_extra_map_data(input, output, params, target, xmin, ymin, xmax, ymax):
print( "WE ARE COMPUTING THE EXTRA DATA OF THE MAP : ", input ) print( "WE ARE COMPUTING THE EXTRA DATA OF THE MAP : ", input )
data = json.load(open(input, "r")) data = json.load(open(input, "r"))
nblayer = ["id" in i for i in data["layers"]].count(True) - 1 nblayer = ["id" in i for i in data["layers"]].count(True) - 1
print( "I found ", nblayer, " of extradata") print( "I found ", nblayer, " of extradata")
@ -288,13 +286,17 @@ def get_extra_map_data(input, output, params, target, xmin, ymin, xmax, ymax):
for v in layer["objects"]: for v in layer["objects"]:
if v[ "id" ] == pathID: if v[ "id" ] == pathID:
print( "path data found : " ) print( "path data found : " )
xdata = bytes()
ydata = bytes() xdata = bytes("", "UTF-16")
ydata = bytes("", "UTF-16")
for w in v[ "polyline" ]: for w in v[ "polyline" ]:
path_length = path_length + 1 path_length = path_length + 1
print( "X= ", w[ "x" ], " Y= ", w[ "y" ] ) print( "X= ", w[ "x" ], " Y= ", w[ "y" ] )
xdata += fxconv.u16( int( w[ "x" ] ) ) xdata += fxconv.u16( int( w[ "x" ] ) )
ydata += fxconv.u16( int( w[ "y" ] ) ) ydata += fxconv.u16( int( w[ "y" ] ) )
print("xdata : ", xdata)
print("ydata : ", ydata)
else: else:
print( "PNJ has no Path" ) print( "PNJ has no Path" )

View file

@ -37,7 +37,7 @@ void npc_draw(Game *game) {
for(int v=0; v<NbPoints; v++) for(int v=0; v<NbPoints; v++)
{ {
/*
int16_t deltaX1=((int16_t) (Data->xpath[v % NbPoints] * PXSIZE))-(int16_t) player->wx; int16_t deltaX1=((int16_t) (Data->xpath[v % NbPoints] * PXSIZE))-(int16_t) player->wx;
int16_t deltaY1=((int16_t) (Data->ypath[v % NbPoints] * PXSIZE))-(int16_t) player->wy; int16_t deltaY1=((int16_t) (Data->ypath[v % NbPoints] * PXSIZE))-(int16_t) player->wy;
@ -47,7 +47,7 @@ void npc_draw(Game *game) {
dline( player->px + deltaX1, player->py + deltaY1, dline( player->px + deltaX1, player->py + deltaY1,
player->px + deltaX2, player->py + deltaY2, player->px + deltaX2, player->py + deltaY2,
PATH_COLOR); PATH_COLOR);
*/
} }