Here's a cool tiny 3d modeller.

Hi tried to test with masm, but ive proble with imports and its declared structures.
Anyone here who can help me with this imports?

espessially:

#define MAXSIZE 250000

// vertex used in qoob
typedef struct vert_s { float x,y,z;} Vert;
// quad used in qoob.. all qoob meshes are composed only of quads
typedef uint Quad[4];
// a qoob mesh - the unpacked/uncompressed model that can be rendered
typedef struct obj_s {
  uint  nv;    // number of vertices in object
  uint  nq;    // number of quads in model
  Quad  q;    // the quad indices a,b,c,d (nq*4)
  Vert  v;    // the vertices x,y,z (nv*3)
  Vert  n;    // the vertex normals x,y,z (nv*3)
  Vert  fn;  // the face normals x,y,z (nq*3)
  uint  sel;  // which polygons are selected
} Object;

after declaring a struct with that size, its inializing for Minutes.


http://qoob.weebly.com/
Thanks in advance.
hmi222
Posted on 2010-12-16 02:02:33 by hmi222

This is not MASM - show your work and I'll help.
Posted on 2010-12-16 06:50:07 by Homer
no ,thats from C-Header file which qoob comes with.
So when im at home ill post my inc file.

Thanx in advance HOMER

hmi222
Posted on 2010-12-16 07:50:10 by hmi222
Ok. Here is the qoob.inc and the Main.asm. It seems that the imports are working with the use of "qoobfull.obj".
what i got now is an exeption error c000005 with call in the "?unpackObj@@YAXPAUqoobo_s@@PAUobj_s@@@Z" function.

And instead of declaring a model by a struct, i alloc memory with its structure size, cause masm is init for minutes. thats
a problem since higher than masm 6.1 with big structs.

I hope somebody can test or help me.
That would be cool running that models with masm.
i ll contact the coder for help too.
If there will be a solution, ill post here too.
Thanx in advance.
hmi222


;Qoob.INC Start
;############################################################################

;--- include file created by h2incx v0.99.20 (copyright 2005-2009 japheth)
;--- source file: c:\h2inc\qoob.h, last modified: 10/23/2010 15:12
;--- cmdline used for creation: -c qoob.h


;// ********************************************************//
;// COMMENT THIS LINE TO USE FULL LIBRARY (eg in a modeller)
;// WHEN MAKING AN INTRO UNCOMMENT THE LINE
;//#define INTROMODE
;// You can of course set this in your compiler
;// ********************************************************//
MAXRANGE  EQU 486
;// The maximum size of meshes supported by qoob library...its a size coding thing.
MAXSIZE  EQU 250000
;// The maximum number of qoob modelling commands used for qoob compressed models
MAXCOMMANDS EQU 256
PI      EQU 3.14159265
DTR    EQU PI / 180.0

MN macro a,b
  exitm <( ( ( a ) < ( b ) ) ? ( a ) : ( b ) ) >
  endm
MX macro a,b
  exitm <( ( ( a ) > ( b ) ) ? ( a ) : ( b ) ) >
  endm
LRP macro a,b,t
  exitm <( ( 1.0 - ( t ) ) * ( a ) + ( t ) * ( b ) ) >
  endm
BTW macro a,b,c
  exitm <( ( ( ( c ) >= ( a ) ) && ( ( c ) <= ( b ) ) ) ? 1 : 0 ) >
  endm
SMOOTHSTEP macro x
  exitm <( ( x ) * ( x ) * ( 3 - 2 * ( x ) ) ) >
  endm
RCLAMPF macro v
  exitm <( ( v ) < - 8.0 ? - 8.0 : ( v ) > 8.0 ? 8.0 : ( v ) ) >
  endm


;// a qoob object vert short form macro : object,quad,vertex(0..3)
QV macro o,qi,vi
  exitm <( ( o ) -> v [ ( o ) -> q [ ( qi ) ] [ ( vi ) ] ] ) >
  endm
;// a qoob objevt vertex normal short form macro: object,quad,vertex(0..3)
QN macro o,qi,vi
  exitm <( ( o ) -> n [ ( o ) -> q [ ( qi ) ] [ ( vi ) ] ] ) >
  endm
uint typedef DWORD
uchar typedef BYTE


;// vertex used in qoob
Vert  struct
x REAL4 ?
y REAL4 ?
z REAL4 ?
Vert  ends

;// quad used in qoob.. all qoob meshes are composed only of quads
Quad struct
  uint 4 dup (?)
Quad ends
;// a qoob mesh - the unpacked/uncompressed model that can be rendered
Object  struct
nv  uint  ?
;// number of vertices in object
nq  uint  ?
;// number of quads in model
q Quad MAXSIZE dup (<>)
;// the quad indices a,b,c,d (nq*4)
v Vert MAXSIZE dup (<>)
;// the vertices x,y,z (nv*3)
n Vert MAXSIZE dup (<>)
;// the vertex normals x,y,z (nv*3)
fn  Vert MAXSIZE dup (<>)
;// the face normals x,y,z (nq*3)
sel uint MAXSIZE dup (?)
;// which polygons are selected
Object  ends


;// a qoob compressed/packed model format ...
;// this struct is for storing a series of qoob lib modelling commands
qoobObj struct
ncom  uchar ?
;// numnber of commands
com uchar MAXCOMMANDS dup (?)
;// the commands
data  uchar MAXCOMMANDS dup (?)
;// data for commands that take a single float but comrepssed to char size
picks uint MAXCOMMANDS dup (?)
;// picking data
qoobObj ends


?unpackObj@@YAXPAUqoobo_s@@PAUobj_s@@@Z PROTO SYSCALL ;CDECL in qoobfull.obj
;?unpackObj@@YIXPAUqoobo_s@@PAUobj_s@@@Z PROTO SYSCALL  ;fastcall in qoob.obj

;Qoob.INC END
;############################################################################



;Main.ASM Start
;############################################################################


.586
.model flat,stdcall
option casemap:none

include windows.inc
include kernel32.inc
include user32.inc
include gdi32.inc
;include msvcrt.inc

include gl.def
include glext.inc
include glu.def
include wglext.inc
include wingdi.inc
include qoob.inc

includelib kernel32.lib
includelib user32.lib
includelib gdi32.lib
;includelib msvcrt.lib
includelib opengl32.lib
includelib glu32.lib






.data
; C:\Ablage\ASM\qoobrelease102\modeller\rhino.qob is 1538 bytes long
;Rhino Demo Model

rhino db 145,31,20,50,29,15,20,31,12,13,12,20,50,29,8,15
db 12,13,20,50,12,50,24,22,22,12,28,5,20,50,50,50
db 50,29,15,15,29,15,8,15,20,50,22,18,20,50,22,22
db 18,20,50,22,22,18,12,20,50,50,29,8,8,4,20,50
db 50,22,15,20,50,50,13,20,50,50,29,8,4,8,29,8
db 15,8,15,12,20,50,50,13,10,13,28,20,50,50,29,15
db 13,50,13,20,50,29,8,13,29,15,12,8,22,22,18,20
db 50,50,22,15,20,50,24,22,22,15,28,20,50,50,29,15
db 15,20,50,50,50,50,50,50,50,29,15,8,20,50,50,22
db 15,14,3,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,128,128,128,128,131,128,128,106,137,100,128,128,128,135
db 159,174,116,128,128,121,128,128,128,128,154,128,140,128,128,128
db 128,128,128,131,133,128,131,148,130,128,128,128,152,128,128,128
db 128,109,128,128,128,128,135,131,128,128,128,128,135,135,142,128
db 128,128,128,125,128,128,128,125,128,128,128,128,135,142,134,128
db 135,159,182,199,130,128,128,128,128,126,128,128,128,128,128,131
db 133,128,134,128,128,128,135,135,128,131,130,137,128,128,129,128
db 128,128,128,119,128,128,128,128,128,131,128,128,128,128,128,131
db 89,128,128,128,128,128,128,128,128,128,131,148,128,128,128,128
db 184,127,134,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,5,0,0,0,14,0,0,0,14,0,0,0,12,0
db 0,0,13,0,0,0,14,0,0,0,28,0,0,0,31,0
db 0,0,97,0,0,0,92,0,0,0,107,0,0,0,40,0
db 0,0,43,0,0,0,63,0,0,0,64,0,0,0,110,0
db 0,0,115,0,0,0,40,0,0,0,41,0,0,0,52,0
db 0,0,55,0,0,0,213,0,0,0,242,0,0,0,35,2
db 0,0,75,0,0,0,233,0,0,0,2,1,0,0,137,0
db 0,0,112,3,0,0,71,3,0,0,9,6,0,0,12,6
db 0,0,217,5,0,0,193,5,0,0,132,5,0,0,145,5
db 0,0,148,5,0,0,6,7,0,0,176,6,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0

.data?
lpmymesh dd ?

.code
main:
invoke GetModuleHandle,NULL


;Alloc place for a model, cause MASM inits such a big struct for minutes.
mov eax,sizeof(Object)
invoke GlobalAlloc,GMEM_MOVEABLE,eax
mov lpmymesh,eax


mov ecx,offset rhino
mov edi,lpmymesh
push ecx
push edi
call ?unpackObj@@YAXPAUqoobo_s@@PAUobj_s@@@Z;cdecl
;call ?unpackObj@@YIXPAUqoobo_s@@PAUobj_s@@@Z;fastcall

xor eax,eax
invoke ExitProcess,eax
end main

;Main.ASM END
;############################################################################
Posted on 2010-12-22 07:47:45 by hmi222
0xC000005 is an Access Violation. So apparently the Qoob unpack function is reading or writing memory that it does not have access to.
This could for example be because you are not passing the correct pointers, or because your struct alignment is not valid, to name but a few things.

My suggestion is to build a simple C++ program that works, and then generate an assembly listing, and compare it to your MASM code. The C++ assembly listing will tell you the correct struct definition, the correct way to pass the arguments etc.
Posted on 2010-12-22 10:06:29 by Scali
So that was asm list generated from a c-konsole prog.


; Listing generated by Microsoft (R) Optimizing Compiler Version 16.00.30319.01

TITLE c:\dokumente und einstellungen\tross\eigene dateien\visual studio 2010\Projects\Qoob_Kons\Qoob_Kons\Main.cpp
.686P
.XMM
include listing.inc
.model flat

INCLUDELIB MSVCRTD
INCLUDELIB OLDNAMES

PUBLIC ?qobj0@@3Uqoobo_s@@A ; qobj0
_DATA SEGMENT
?qobj0@@3Uqoobo_s@@A DB 091H ; qobj0
DB 01fH
DB 014H
DB 032H
DB 01dH
DB 0fH
DB 014H
DB 01fH
DB 0cH
DB 0dH
DB 0cH
DB 014H
DB 032H
DB 01dH
DB 08H
DB 0fH
DB 0cH
DB 0dH
DB 014H
DB 032H
DB 0cH
DB 032H
DB 018H
DB 016H
DB 016H
DB 0cH
DB 01cH
DB 05H
DB 014H
DB 032H
DB 032H
DB 032H
DB 032H
DB 01dH
DB 0fH
DB 0fH
DB 01dH
DB 0fH
DB 08H
DB 0fH
DB 014H
DB 032H
DB 016H
DB 012H
DB 014H
DB 032H
DB 016H
DB 016H
DB 012H
DB 014H
DB 032H
DB 016H
DB 016H
DB 012H
DB 0cH
DB 014H
DB 032H
DB 032H
DB 01dH
DB 08H
DB 08H
DB 04H
DB 014H
DB 032H
DB 032H
DB 016H
DB 0fH
DB 014H
DB 032H
DB 032H
DB 0dH
DB 014H
DB 032H
DB 032H
DB 01dH
DB 08H
DB 04H
DB 08H
DB 01dH
DB 08H
DB 0fH
DB 08H
DB 0fH
DB 0cH
DB 014H
DB 032H
DB 032H
DB 0aH
DB 0dH
DB 01cH
DB 014H
DB 032H
DB 032H
DB 01dH
DB 0fH
DB 0dH
DB 032H
DB 0dH
DB 014H
DB 032H
DB 01dH
DB 08H
DB 0dH
DB 01dH
DB 0fH
DB 0cH
DB 08H
DB 016H
DB 016H
DB 012H
DB 014H
DB 032H
DB 032H
DB 016H
DB 0fH
DB 014H
DB 032H
DB 018H
DB 016H
DB 016H
DB 0fH
DB 01cH
DB 014H
DB 032H
DB 032H
DB 01dH
DB 0fH
DB 0fH
DB 014H
DB 032H
DB 032H
DB 032H
DB 032H
DB 032H
DB 032H
DB 032H
DB 01dH
DB 0fH
DB 08H
DB 014H
DB 032H
DB 032H
DB 016H
DB 0fH
DB 0eH
DB 03H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 080H
DB 080H
DB 080H
DB 080H
DB 083H
DB 080H
DB 080H
DB 06aH
DB 089H
DB 064H
DB 080H
DB 080H
DB 080H
DB 087H
DB 09fH
DB 0aeH
DB 074H
DB 080H
DB 080H
DB 079H
DB 080H
DB 080H
DB 080H
DB 080H
DB 09aH
DB 080H
DB 08cH
DB 080H
DB 080H
DB 080H
DB 080H
DB 080H
DB 080H
DB 083H
DB 085H
DB 080H
DB 083H
DB 094H
DB 082H
DB 080H
DB 080H
DB 080H
DB 098H
DB 080H
DB 080H
DB 080H
DB 080H
DB 06dH
DB 080H
DB 080H
DB 080H
DB 080H
DB 087H
DB 083H
DB 080H
DB 080H
DB 080H
DB 080H
DB 087H
DB 087H
DB 08eH
DB 080H
DB 080H
DB 080H
DB 080H
DB 07dH
DB 080H
DB 080H
DB 080H
DB 07dH
DB 080H
DB 080H
DB 080H
DB 080H
DB 087H
DB 08eH
DB 086H
DB 080H
DB 087H
DB 09fH
DB 0b6H
DB 0c7H
DB 082H
DB 080H
DB 080H
DB 080H
DB 080H
DB 07eH
DB 080H
DB 080H
DB 080H
DB 080H
DB 080H
DB 083H
DB 085H
DB 080H
DB 086H
DB 080H
DB 080H
DB 080H
DB 087H
DB 087H
DB 080H
DB 083H
DB 082H
DB 089H
DB 080H
DB 080H
DB 081H
DB 080H
DB 080H
DB 080H
DB 080H
DB 077H
DB 080H
DB 080H
DB 080H
DB 080H
DB 080H
DB 083H
DB 080H
DB 080H
DB 080H
DB 080H
DB 080H
DB 083H
DB 059H
DB 080H
DB 080H
DB 080H
DB 080H
DB 080H
DB 080H
DB 080H
DB 080H
DB 080H
DB 083H
DB 094H
DB 080H
DB 080H
DB 080H
DB 080H
DB 0b8H
DB 07fH
DB 086H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DB 00H
DD 05H
DD 0eH
DD 0eH
DD 0cH
DD 0dH
DD 0eH
DD 01cH
DD 01fH
DD 061H
DD 05cH
DD 06bH
DD 028H
DD 02bH
DD 03fH
DD 040H
DD 06eH
DD 073H
DD 028H
DD 029H
DD 034H
DD 037H
DD 0d5H
DD 0f2H
DD 0223H
DD 04bH
DD 0e9H
DD 0102H
DD 089H
DD 0370H
DD 0347H
DD 0609H
DD 060cH
DD 05d9H
DD 05c1H
DD 0584H
DD 0591H
DD 0594H
DD 0706H
DD 06b0H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
DD 00H
_DATA ENDS
PUBLIC _main
EXTRN ?unpackObj@@YAXPAUqoobo_s@@PAUobj_s@@@Z:PROC ; unpackObj
EXTRN __RTC_CheckEsp:PROC
EXTRN @_RTC_CheckStackVars@8:PROC
EXTRN __chkstk:PROC
EXTRN __RTC_Shutdown:PROC
EXTRN __RTC_InitBase:PROC
; COMDAT rtc$TMZ
; File c:\dokumente und einstellungen\tross\eigene dateien\visual studio 2010\projects\qoob_kons\qoob_kons\main.cpp
rtc$TMZ SEGMENT
__RTC_Shutdown.rtc$TMZ DD FLAT:__RTC_Shutdown
rtc$TMZ ENDS
; COMDAT rtc$IMZ
rtc$IMZ SEGMENT
__RTC_InitBase.rtc$IMZ DD FLAT:__RTC_InitBase
; Function compile flags: /Odtp /RTCsu /ZI
rtc$IMZ ENDS
; COMDAT _main
_TEXT SEGMENT
_mymesh$ = -14000012 ; size = 14000008
_main PROC ; COMDAT
; Line 8
push ebp
mov ebp, esp
mov eax, 14000208 ; 00d5a050H
call __chkstk
push ebx
push esi
push edi
lea edi, DWORD PTR
mov ecx, 3500052 ; 00356814H
mov eax, -858993460 ; ccccccccH
rep stosd
; Line 10
lea eax, DWORD PTR _mymesh$
push eax
push OFFSET ?qobj0@@3Uqoobo_s@@A ; qobj0
call ?unpackObj@@YAXPAUqoobo_s@@PAUobj_s@@@Z ; unpackObj
add esp, 8
; Line 13
xor eax, eax
push edx
mov ecx, ebp
push eax
lea edx, DWORD PTR $LN5@main
call @_RTC_CheckStackVars@8
pop eax
pop edx
pop edi
pop esi
pop ebx
add esp, 14000208 ; 00d5a050H
cmp ebp, esp
call __RTC_CheckEsp
mov esp, ebp
pop ebp
ret 0
npad 3
$LN5@main:
DD 1
DD $LN4@main
$LN4@main:
DD -14000012 ; ff2a6074H
DD 14000008 ; 00d59f88H
DD $LN3@main
$LN3@main:
DB 109 ; 0000006dH
DB 121 ; 00000079H
DB 109 ; 0000006dH
DB 101 ; 00000065H
DB 115 ; 00000073H
DB 104 ; 00000068H
DB 0
_main ENDP
_TEXT ENDS
END



the only difference i see are the pushs of the arguments



;Alloc place for a model, cause MASM inits such a big struct for minutes.
mov eax,sizeof(Object)
invoke GlobalAlloc,GMEM_MOVEABLE,eax
mov lpmymesh,eax

                push eax
push ecx,offset rhino
call ?unpackObj@@YAXPAUqoobo_s@@PAUobj_s@@@Z;cdecl



Now ive no idea anymore.
Posted on 2010-12-23 01:15:29 by hmi222
Note the "add esp, 8" after the call in the C-generated code.
Apparently the unpack function is cdecl, and the stack needs to be cleaned up by the caller.
That's probably not what causes your problem, but I'd have to look into it with an actual binary and a debugger, which I cannot do right now.
Posted on 2010-12-23 01:48:06 by Scali
Hi Scali!
Thanx.
Yu re right ive to clean up the stack manually with add esp,8.
i ll post a link to a binary.

Thanx in advance.
hmi222


Posted on 2010-12-23 04:43:47 by hmi222
Oh yea, I noticed you had the arguments reversed. That would be a recipe for disaster.
C++ pushes right-to-left, so something like unpack(obj, mesh) would turn into:
push mesh
push obj
call unpack.
But switching them around didn't help?
Posted on 2010-12-23 06:40:30 by Scali
no i think there's a problem in the obj file.
trying now with olly debug to locate.
will report!
Posted on 2010-12-23 06:41:56 by hmi222
Well, I've had a go with the code... I'm not entirely sure what happens, but it doesn't unpack correctly. It requires more memory than in C++ for some reason (allocating 2*sizeof(Object) prevents it from crashing), but after it has unpacked, it reports less vertices and quads than the C++ version.
Makes very little sense to me at this point, since I'm not doing much, other than calling the unpackObj() function, and I've verified that my code and the C++ code for that are the same.
Posted on 2010-12-23 14:12:51 by Scali
ok.
ill have a look too on this memory prob.
Posted on 2010-12-26 07:40:00 by hmi222
I'm a devout Nasmist, so can't vouch for this, but I understand that the workaround for Masm's "speed problem" with large objects is to assemble as OMF and let link convert it. "Malloc" is probably a better bet, but this might be worth a try...

Best,
Frank

Posted on 2010-12-26 13:03:53 by fbkotler
Hi fbkotler.
will try to nasm as yu see in nasm-forum!!
:)
Posted on 2011-01-05 15:43:37 by hmi222
Hi!
First working version.
Nothing optimized, but working.
Still finishing it!
Its Fastcall version!

Attachments:
Posted on 2011-01-05 15:48:16 by hmi222
So, I'm curious: what exactly was the magic fix that made it work?
Posted on 2011-01-05 16:20:34 by Scali
Scali:

I tested with the delivered Rhino Model.
So i converted it with Bin2DB for MASM integration.
The first Byte in this array is as yu see in qoobobj-struct the number of commands.
If this is bigger than Dez 129 that it runs in this error in the unpacking procedure.
So i tested  with smaller models i did myself and some from geexlab!
And i used the fastcall obj-file (qoob.obj, not qoobfull.obj)
Im in contact with Auld, the coder of qoob to solve,that problem.
Cheers
hmi222

btw. is it working for yu?
Here's a second test with 4klang softsynth from Alcatraz!

Attachments:
Posted on 2011-01-05 16:38:16 by hmi222

Scali:

I tested with the delivered Rhino Model.
So i converted it with Bin2DB for MASM integration.
The first Byte in this array is as yu see in qoobobj-struct the number of commands.
If this is bigger than Dez 129 that it runs in this error in the unpacking procedure.
So i tested  with smaller models i did myself and some from geexlab!
And i used the fastcall obj-file (qoob.obj, not qoobfull.obj)
Im in contact with Auld, the coder of qoob to solve,that problem.
Cheers
hmi222

btw. is it working for yu?
Here's a second test with 4klang softsynth from Alcatraz!


Hum, so if you have too many commands in your model, it corrupts itself?
Then the problem may be related to the linker settings for the stack. The library might corrupt its stack internally. It could be that the default settings for C++ were slightly different, so the rhino model worked in C++ for me, while it did not work in MASM.
I haven't looked into it anymore after the first test I did with C++/MASM.

I did try the executable that you posted, and that worked fine for me.
Posted on 2011-01-06 03:27:33 by Scali
Thanx for testing Scali!  :)
Posted on 2011-01-06 05:14:45 by hmi222