Skip to content

Commit fd213d1

Browse files
committed
Fix some 32-bit object assumptions in the Squeak3D support code.
On 64-bits "B3DDemoSurfaces new show1" still fails but no longer crashes the VM.
1 parent a3f516f commit fd213d1

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

platforms/Cross/plugins/Squeak3D/b3d.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
/* primary include file */
2727

28+
#include "sqMemoryAccess.h" /* for sqInt */
2829
#include "sqAssert.h"
2930
#include "b3dTypes.h"
3031

platforms/Cross/plugins/Squeak3D/b3dRemap.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
Remap all allocated faces using the given offsets
1919
*/
2020
/* INLINE b3dRemapFaces(list, attrOffset, edgeOffset) */
21-
void b3dRemapFaces(B3DFaceAllocList *list, int attrOffset, int edgeOffset)
21+
void b3dRemapFaces(B3DFaceAllocList *list, sqInt attrOffset, sqInt edgeOffset)
2222
{
2323
int i;
2424

@@ -40,7 +40,7 @@ void b3dRemapFaces(B3DFaceAllocList *list, int attrOffset, int edgeOffset)
4040
Remap all allocated edges using the given offset
4141
*/
4242
/* INLINE b3dRemapEdges(list, faceOffset) */
43-
void b3dRemapEdges(B3DEdgeAllocList *list, int faceOffset)
43+
void b3dRemapEdges(B3DEdgeAllocList *list, sqInt faceOffset)
4444
{
4545
int i;
4646
for(i=0; i<list->size;i++) {
@@ -59,7 +59,7 @@ void b3dRemapEdges(B3DEdgeAllocList *list, int faceOffset)
5959
Remap the fill list using the given offset
6060
*/
6161
/* INLINE b3dRemapFills(fillList, offset) */
62-
void b3dRemapFills(B3DFillList *fillList, int offset)
62+
void b3dRemapFills(B3DFillList *fillList, sqInt offset)
6363
{
6464
B3DPrimitiveFace *temp;
6565
if(fillList->firstFace)
@@ -81,7 +81,7 @@ void b3dRemapFills(B3DFillList *fillList, int offset)
8181
Remap all edge pointers using the given offset
8282
*/
8383
/* INLINE b3dRemapEdgeList(list, edgeOffset) */
84-
void b3dRemapEdgeList(B3DPrimitiveEdgeList *list, int edgeOffset)
84+
void b3dRemapEdgeList(B3DPrimitiveEdgeList *list, sqInt edgeOffset)
8585
{
8686
int i;
8787
for(i=0; i<list->size;i++) {
@@ -94,7 +94,7 @@ void b3dRemapEdgeList(B3DPrimitiveEdgeList *list, int edgeOffset)
9494
Remap all edge pointers using the given offset
9595
*/
9696
/* INLINE b3dRemapAET(list, edgeOffset, aetOffset, firstEdge, lastEdge) */
97-
void b3dRemapAET(B3DActiveEdgeTable *list, int edgeOffset, int aetOffset, void *firstEdge, void *lastEdge)
97+
void b3dRemapAET(B3DActiveEdgeTable *list, sqInt edgeOffset, sqInt aetOffset, void *firstEdge, void *lastEdge)
9898
{
9999
int i;
100100
if(edgeOffset)
@@ -122,7 +122,7 @@ void b3dRemapAET(B3DActiveEdgeTable *list, int edgeOffset, int aetOffset, void *
122122
Remap all vertices in the specified range using the given offset
123123
*/
124124
/* INLINE b3dRemapEdgeVertices(list, vtxOffset, firstVtx, lastVtx) */
125-
void b3dRemapEdgeVertices(B3DEdgeAllocList *list, int vtxOffset, void *firstVtx, void *lastVtx)
125+
void b3dRemapEdgeVertices(B3DEdgeAllocList *list, sqInt vtxOffset, void *firstVtx, void *lastVtx)
126126
{
127127
int i;
128128
for(i=0; i<list->size; i++) {
@@ -139,7 +139,7 @@ void b3dRemapEdgeVertices(B3DEdgeAllocList *list, int vtxOffset, void *firstVtx,
139139
Remap all vertices in the specified range using the given offset
140140
*/
141141
/* INLINE b3dRemapFaceVertices(list, vtxOffset, firstVtx, lastVtx) */
142-
void b3dRemapFaceVertices(B3DFaceAllocList *list, int vtxOffset, void *firstVtx, void *lastVtx)
142+
void b3dRemapFaceVertices(B3DFaceAllocList *list, sqInt vtxOffset, void *firstVtx, void *lastVtx)
143143
{
144144
int i;
145145
for(i=0; i<list->size; i++) {
@@ -157,7 +157,7 @@ void b3dRemapFaceVertices(B3DFaceAllocList *list, int vtxOffset, void *firstVtx,
157157
Remap all free faces using the given offset
158158
*/
159159
/* INLINE b3dRemapFaceFree(list, faceOffset) */
160-
void b3dRemapFaceFree(B3DFaceAllocList *list, int faceOffset)
160+
void b3dRemapFaceFree(B3DFaceAllocList *list, sqInt faceOffset)
161161
{
162162
B3DPrimitiveFace *freeObj;
163163
if(list->firstFree) {
@@ -175,7 +175,7 @@ void b3dRemapFaceFree(B3DFaceAllocList *list, int faceOffset)
175175
Remap all free edges using the given offset
176176
*/
177177
/* INLINE b3dRemapEdgeFree(list, edgeOffset) */
178-
void b3dRemapEdgeFree(B3DEdgeAllocList *list, int edgeOffset)
178+
void b3dRemapEdgeFree(B3DEdgeAllocList *list, sqInt edgeOffset)
179179
{
180180
B3DPrimitiveEdge *freeObj;
181181
if(list->firstFree) {
@@ -193,7 +193,7 @@ void b3dRemapEdgeFree(B3DEdgeAllocList *list, int edgeOffset)
193193
Remap all free attributes using the given offset
194194
*/
195195
/* INLINE b3dRemapAttrFree(list, attrOffset) */
196-
void b3dRemapAttributes(B3DAttrAllocList *list, int attrOffset)
196+
void b3dRemapAttributes(B3DAttrAllocList *list, sqInt attrOffset)
197197
{
198198
int i;
199199
for(i=0; i < list->size; i++) {
@@ -209,7 +209,8 @@ void b3dRemapAttributes(B3DAttrAllocList *list, int attrOffset)
209209
*/
210210
int b3dValidateAndRemapState(B3DRasterizerState *state)
211211
{
212-
int faceOffset, edgeOffset, attrOffset, aetOffset, objOffset, i;
212+
sqInt faceOffset, edgeOffset, attrOffset, aetOffset, objOffset;
213+
int i;
213214
B3DPrimitiveObject *obj;
214215

215216
if(!state) return B3D_GENERIC_ERROR;

platforms/Cross/plugins/Squeak3D/b3dTypes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ typedef struct B3DPrimitiveViewport {
299299
typedef struct B3DPrimitiveObject {
300300
int magic;
301301
void *This;
302-
int __oop__; /* actual ST oop */
302+
sqInt __oop__; /* actual ST oop */
303303
struct B3DPrimitiveObject *next;
304304
struct B3DPrimitiveObject *prev;
305305

0 commit comments

Comments
 (0)