Technical support > Mac

Current issues with 2.3 PPC build (Now with Graphics!)

(1/8) > >>

keybounce:
I'm having trouble with 2.3 building universal on a PPC.


--- Code: ---stbmac:23 Michael$ svn info
Path: .
URL: https://ufoai.svn.sourceforge.net/svnroot/ufoai/ufoai/branches/ufoai_2.3
Repository Root: https://ufoai.svn.sourceforge.net/svnroot/ufoai
Repository UUID: 39b98707-f80d-0410-bc7e-c6b02f5409da
Revision: 30059
Node Kind: directory
Schedule: normal
Last Changed Author: tlh2000
Last Changed Rev: 30046
Last Changed Date: 2010-05-17 23:57:30 -0700 (Mon, 17 May 2010)

stbmac:23 Michael$ svn st
?      Makefile.in.orig
?      svn-diff.txt
?      port-readme.txt
?      svn-diff.nosignal.txt
?      svn-diff-2.3.txt
stbmac:23 Michael$ make models
 * [MOD] src/tools/ufomodel/ufomodel.c
lipo: can't create output file: debug-darwin-universal/tools/ufomodel/tools/ufomodel/ufomodel.o (No such file or directory)
make: *** [debug-darwin-universal/tools/ufomodel/tools/ufomodel/ufomodel.o] Error 1
stbmac:23 Michael$
stbmac:23 Michael$ make
 * [GAM] src/game/g_actor.c
 * [GAM] src/game/g_ai.c
 * [GAM] src/game/g_ai_lua.c
 * [GAM] src/game/g_client.c
 * [GAM] src/game/g_combat.c
 * [GAM] src/game/g_cmds.c
 * [GAM] src/game/g_edicts.c
^CInterrupted by signal 2
make: *** [debug-darwin-universal/game/game/g_edicts.o] Interrupt

stbmac:23 Michael$ make models
 * [MOD] src/tools/ufomodel/ufomodel.c
 * [MOD] src/shared/mathlib.c
 * [MOD] src/shared/byte.c
 * [MOD] src/shared/images.c
 * [MOD] src/shared/parse.c
 * [MOD] src/shared/shared.c
src/shared/shared.c: In function ‘Com_sprintf’:
src/shared/shared.c:473: warning: comparison is always false due to limited range of data type
src/shared/shared.c:475: warning: comparison is always true due to limited range of data type
src/shared/shared.c: In function ‘Com_sprintf’:
src/shared/shared.c:473: warning: comparison is always false due to limited range of data type
src/shared/shared.c:475: warning: comparison is always true due to limited range of data type
 * [MOD] src/common/files.c
 * [MOD] src/common/list.c
 * [MOD] src/common/mem.c
 * [MOD] src/common/unzip.c
 * [MOD] src/common/ioapi.c
 * [MOD] src/client/renderer/r_model_alias.c
 * [MOD] src/client/renderer/r_model_dpm.c
 * [MOD] src/client/renderer/r_model_md2.c
 * [MOD] src/client/renderer/r_model_md3.c
 * [MOD] src/client/renderer/r_model_obj.c
 * [MOD] src/ports/unix/unix_main.c
 * [MOD] ... linking -rdynamic (-lz  -ljpeg  -L/opt/local/lib -lpng12 -lz   -L/opt/local/lib -lSDLmain -lSDL -Wl,-framework,Cocoa -lSDL_image  -L/opt/local/lib -lSDLmain -lSDL -Wl,-framework,Cocoa)
./ufomodel -mdx -overwrite -v  -s 0.5 -f models/aircraft/craft_arm_plate/plating.md2
---- ufomodel 0.2 ----

---- filesystem initialization -----
Adding game dir: /usr/local/share/ufoai/base
Adding game dir: /Users/Michael/Documents/UFOAI-2.3-dev/base
Adding game dir: ./base
using ./base for writing
- model 'models/aircraft/craft_arm_plate/plating.md2'
Error: R_ModForName: unknown fileid for models/aircraft/craft_arm_plate/plating.md2
make: *** [base/models/aircraft/craft_arm_plate/plating.mdx] Error 1
stbmac:23 Michael$

--- End code ---

First, I'm looking at 30046. Starting with an absolutely stock, clean copy.

'make models' will fail -- the directories for the .o files don't exist.
'make' will set them up. And then, 'make models' will compile.

But it doesn't run. It fails. And doesn't give any indication as to why.

Gdb begins ...

Edit 1:
--- Code: ---Breakpoint 1, Com_Error (code=0, fmt=0x2455c "R_ModForName: unknown fileid for %s") at src/tools/ufomodel/ufomodel.c:178
178 va_start(argptr, fmt);
(gdb) bt
#0  Com_Error (code=0, fmt=0x2455c "R_ModForName: unknown fileid for %s") at src/tools/ufomodel/ufomodel.c:178
#1  0x00002590 in LoadModel (name=0x277bc "models/aircraft/craft_arm_plate/plating.md2") at src/tools/ufomodel/ufomodel.c:227
#2  0x00002814 in PrecalcNormalsAndTangents (filename=0x277bc "models/aircraft/craft_arm_plate/plating.md2") at src/tools/ufomodel/ufomodel.c:284
#3  0x00003ed8 in SDL_main (argc=8, argv=0x25095c0) at src/tools/ufomodel/ufomodel.c:678
#4  0x000236ec in -[SDLMain applicationDidFinishLaunching:] ()
#5  0x96d39688 in _nsnote_callback ()
#6  0x94ce243c in _CFXNotificationPostNotification ()
#7  0x96d36dc4 in -[NSNotificationCenter postNotificationName:object:userInfo:] ()
#8  0x93b64858 in -[NSApplication _postDidFinishNotification] ()

--- End code ---
Not very deep in the code...

keybounce:
Alright, do you see an obvious byteswap issue here?

stbmac:23 Michael$ egrep IDALIASHEADER src/*/*.h
src/common/qfiles.h:#define IDALIASHEADER   (('2'<<24)+('P'<<16)+('D'<<8)+'I')


--- Code: ---(gdb) p buf
$8 = (byte *) 0x282be2c "IDP2\b"

(gdb) p LittleLong(*(unsigned *) buf)
$10 = 1229213746

(gdb) p  (('2'<<24)+('P'<<16)+('D'<<8)+'I')
$13 = 844121161


207 /* call the appropriate loader */
208 switch (LittleLong(*(unsigned *) buf)) {
209 case IDALIASHEADER:
210 /* MD2 header */
211 R_ModLoadAliasMD2Model(mod, buf, modfilelen, qfalse);
212 break;
(gdb)
213
214 case DPMHEADER:
215 R_ModLoadAliasDPMModel(mod, buf, modfilelen);
216 break;
217
218 case IDMD3HEADER:
219 /* MD3 header */
220 R_ModLoadAliasMD3Model(mod, buf, modfilelen);
221 break;
222
(gdb)
223 default:
224 if (!Q_strcasecmp(mod->name + strlen(mod->name) - 4, ".obj"))
225 R_LoadObjModel(mod, buf, modfilelen);
226 else
227 Com_Error(ERR_FATAL, "R_ModForName: unknown fileid for %s", mod->name);

--- End code ---

keybounce:
Definitely byteswap.

- model 'models/aircraft/craft_arm_plate/plating.md2'
Debug: IDAliasHeader is 32504449, swapped is 32504449
Debug: Buf is 49445032, swapped is 49445032
Error: R_ModForName: unknown fileid for models/aircraft/craft_arm_plate/plating.md2

LittleLong() is a no-op on PPC.
The bytes are backwards (those are hex numbers).

What's the best way to solve this? Is it:
1. Redefine LittleLong to do the swapping
2. Conditional #defines so that the value is different on PPC?
3. Something else?

keybounce:
Ok, it looks like the answer is "Something else".

- LittleLong() is used everywhere.
- IDALIASHEADER is from the quake engine, and playing with it is likely to have trouble elsewhere.


--- Code: ---stbmac:23 Michael$ egrep IDALIASHEADER src/*/*.c
src/server/sv_world.c: case IDALIASHEADER:
stbmac:23 Michael$ egrep IDALIASHEADER src/*/*/*.c
src/client/renderer/r_model.c: case IDALIASHEADER:
src/tools/ufomodel/ufomodel.c:Com_Printf("Debug: IDAliasHeader is %x, swapped is %x\n", IDALIASHEADER, LittleLong(IDALIASHEADER));
src/tools/ufomodel/ufomodel.c: case IDALIASHEADER:
src/tools/ufomodel/ufomodel.c: case IDALIASHEADER:

--- End code ---
Or perhaps not -- it's used once in the server, once in the client rendering, and in the ufomodel code where I'm finding it broken.

The other option is to byteswap all the data being loaded in from the file before processing. And then, it looks like the file is in i386 format as "native", and the PPC is the only thing that's going to need swapping.

Which leads to the next question: How much is the data not being properly swapped in/out during generation and processing over all of the code? Is the code supposed to be byte order fixed, or is it supposed to be "Lets assume x86"?

Mattn:
maybe SwapInit() isn't calles for ufomodel?

Navigation

[0] Message Index

[#] Next page

Go to full version