mirror of
https://github.com/krystalgamer/spidey-decomp.git
synced 2025-02-19 20:30:45 +00:00
Linux build
Added workflow Fix pipeline Introduced fixed-size type and fixed size on Linux
This commit is contained in:
parent
c8e38fb4e1
commit
0ab70dcccb
24
.github/workflows/c-cpp.yml
vendored
Normal file
24
.github/workflows/c-cpp.yml
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
name: C/C++ CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install 32-bit g++ and cmake
|
||||
run: sudo apt install g++-multilib cmake
|
||||
- name: Setup Makefile
|
||||
run: cmake -B out
|
||||
- name: Build
|
||||
run: cmake --build out
|
||||
- name: Run
|
||||
run: ./out/spider
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,3 +5,4 @@ Release/
|
||||
**/env/
|
||||
*.swp
|
||||
*.opt
|
||||
out/
|
||||
|
8
CMakeLists.txt
Normal file
8
CMakeLists.txt
Normal file
@ -0,0 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(spider)
|
||||
|
||||
set (CMAKE_CXX_FLAGS "-m32 -w -fpermissive")
|
||||
|
||||
file(GLOB SRC_FILES *.cpp)
|
||||
|
||||
add_executable(${PROJECT_NAME} ${SRC_FILES})
|
@ -60,7 +60,7 @@ void CBaddy::CleanUpMessages(int a2, int a3)
|
||||
{
|
||||
if (v4)
|
||||
{
|
||||
typedef void (__fastcall *wtvHappeningPtr)(void*, void*, int);
|
||||
typedef void (FASTCALL *wtvHappeningPtr)(void*, void*, int);
|
||||
wtvHappeningPtr wtvHappening = reinterpret_cast<wtvHappeningPtr>(**reinterpret_cast<int**>(v3));
|
||||
wtvHappening(reinterpret_cast<void*>(v3), NULL, 1);
|
||||
}
|
||||
@ -458,7 +458,7 @@ void CBaddy::CleanUpAIPRocList(int a2)
|
||||
{
|
||||
if (v3)
|
||||
{
|
||||
typedef void (__fastcall *wtvHappeningPtr)(void*, void*, int);
|
||||
typedef void (FASTCALL *wtvHappeningPtr)(void*, void*, int);
|
||||
wtvHappeningPtr wtvHappening = reinterpret_cast<wtvHappeningPtr>(**reinterpret_cast<int**>(v3));
|
||||
wtvHappening(reinterpret_cast<void*>(v3), NULL, 1);
|
||||
}
|
||||
|
1
bit.cpp
1
bit.cpp
@ -529,6 +529,7 @@ void validate_CQuadBit(void)
|
||||
|
||||
void validate_CBit(void)
|
||||
{
|
||||
VALIDATE_SIZE(CBit, 0x3C);
|
||||
VALIDATE(CBit, mPrevious, 0x4);
|
||||
VALIDATE(CBit, mNext, 0x8);
|
||||
|
||||
|
2
bit.h
2
bit.h
@ -190,7 +190,7 @@ class CRibbonBit : public CLinked2EndedBit
|
||||
class CTexturedRibbon : public CSpecialDisplay
|
||||
{
|
||||
public:
|
||||
EXPORT void CTexturedRibbon::SetOuterRGBi(int, unsigned char, unsigned char, unsigned char);
|
||||
EXPORT void SetOuterRGBi(int, unsigned char, unsigned char, unsigned char);
|
||||
unsigned char topPad[0x60-0x3C];
|
||||
int* field_60;
|
||||
|
||||
|
4
bit2.h
4
bit2.h
@ -9,7 +9,7 @@
|
||||
class CGPolyLine : public CBit {
|
||||
public:
|
||||
|
||||
unsigned char padTop[0x40-0x3B-4];
|
||||
unsigned char padTop[0x40-0x3C];
|
||||
|
||||
int field_40;
|
||||
CVector field_44;
|
||||
@ -45,7 +45,7 @@ class CPolyLine : public CBit
|
||||
{
|
||||
public:
|
||||
EXPORT void SetSemiTransparent(void);
|
||||
unsigned char topPad;
|
||||
unsigned char topPad[4];
|
||||
|
||||
int field_40;
|
||||
int field_44;
|
||||
|
25
export.h
25
export.h
@ -1,7 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef EXPORT_H
|
||||
#define EXPORT_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#define EXPORT __declspec( dllexport )
|
||||
#define FASTCALL __fastcall
|
||||
#else
|
||||
#define EXPORT
|
||||
#define FASTCALL __attribute__((fastcall))
|
||||
#endif
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#ifdef __linux__
|
||||
#define __int16 short
|
||||
#define __int8 char
|
||||
#endif
|
||||
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned int u32;
|
||||
|
||||
typedef char i8;
|
||||
typedef short i16;
|
||||
typedef int i32;
|
||||
|
||||
static int *Animations = (int*)0x006B245C;
|
||||
|
||||
@ -25,3 +48,5 @@ static void printf_fancy(const char *message, ...) {
|
||||
static void stubbed_printf(char *message){
|
||||
puts(message);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,10 +1,11 @@
|
||||
// friction.h: interface for the CFriction class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
|
||||
#ifndef FRICTION_H
|
||||
#define FRICTION_H
|
||||
|
||||
class CFriction
|
||||
{
|
||||
@ -14,3 +15,5 @@ public:
|
||||
unsigned char vz;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
30
main.cpp
30
main.cpp
@ -1,6 +1,13 @@
|
||||
#define WINDOWS_LEAN_AND_MEAN
|
||||
|
||||
#ifdef __WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#define WINAPI
|
||||
#define HINSTANCE int
|
||||
#define PSTR char*
|
||||
#endif
|
||||
|
||||
|
||||
#include "main.h"
|
||||
#include "ob.h"
|
||||
@ -61,6 +68,7 @@
|
||||
#include "manipob.h"
|
||||
#include "mess.h"
|
||||
#include "ai.h"
|
||||
#include <cstring>
|
||||
|
||||
// @Ok
|
||||
void* CClass::operator new(unsigned int size)
|
||||
@ -118,20 +126,27 @@ void compile_time_assertions(){
|
||||
//StaticAssert<sizeof(CMJ)==0x324>::assert();
|
||||
|
||||
StaticAssert<sizeof(MATRIX)==0x20>::assert();
|
||||
|
||||
StaticAssert<sizeof(__int16)==2>::assert();
|
||||
StaticAssert<sizeof(__int8)==1>::assert();
|
||||
}
|
||||
|
||||
extern int FAIL_VALIDATION;
|
||||
|
||||
#ifdef __WIN32
|
||||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||
PSTR lpCmdLine, int nCmdShow)
|
||||
#else
|
||||
int main()
|
||||
#endif
|
||||
{
|
||||
compile_time_assertions();
|
||||
|
||||
|
||||
|
||||
#ifdef __WIN32
|
||||
AllocConsole();
|
||||
|
||||
|
||||
|
||||
freopen("CONOUT$", "w", stdout);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@ -310,15 +325,18 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||
validate_CAIProc_MoveTo();
|
||||
|
||||
puts("[*] Validation done!");
|
||||
CItem* items = new CItem[1];
|
||||
|
||||
#ifdef __WIN32
|
||||
__asm {
|
||||
|
||||
//int 3
|
||||
|
||||
}
|
||||
CItem* items = new CItem[1];
|
||||
while(1){}
|
||||
#endif
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
return FAIL_VALIDATION;
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ class CMysterioLaser : public CNonRenderedBit
|
||||
{
|
||||
public:
|
||||
EXPORT void SetDamage(int);
|
||||
unsigned char fullPad[0xD];
|
||||
unsigned char fullPad[0x11];
|
||||
int field_4C;
|
||||
unsigned char padBottom[0x64-0x4C-4];
|
||||
};
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "mess.h"
|
||||
|
||||
|
||||
EXPORT int __cdecl PShell_DrawMenuBox(int, int, int, int, int, int, int, int){
|
||||
EXPORT int PShell_DrawMenuBox(int, int, int, int, int, int, int, int){
|
||||
return 69;
|
||||
}
|
||||
|
||||
|
2
spidey.h
2
spidey.h
@ -106,7 +106,7 @@ class CPlayer : public CSuper
|
||||
char field_E2D;
|
||||
char field_E2E;
|
||||
|
||||
unsigned char padBottomPlayer[0xEFC-0xE2E-1];
|
||||
unsigned char padBottomPlayer[(0xEFC-0xE2E)-0x1];
|
||||
|
||||
|
||||
EXPORT void SetCamAngleLock(unsigned __int16);
|
||||
|
2
turret.h
2
turret.h
@ -31,7 +31,7 @@ class CTurretLaser : public CNonRenderedBit
|
||||
public:
|
||||
EXPORT void SetDamage(int);
|
||||
|
||||
unsigned char topPad[0xD];
|
||||
unsigned char topPad[0x11];
|
||||
int field_4C;
|
||||
unsigned char bottomPad[0x64-0x4C-4];
|
||||
};
|
||||
|
@ -1,9 +1,11 @@
|
||||
#include "validate.h"
|
||||
|
||||
int FAIL_VALIDATION = 0;
|
||||
|
||||
void validate_class(int cur, int expected, const char *cls, const char *member){
|
||||
|
||||
if (expected != cur){
|
||||
FAIL_VALIDATION = 1;
|
||||
printf("[!] Expected %X but got %X, for %s->%s\n", expected, cur, cls, member);
|
||||
}
|
||||
else{
|
||||
@ -18,6 +20,7 @@ void validate_class(int cur, int expected, const char *cls, const char *member){
|
||||
|
||||
void validate_size(int cur, int expected, const char *name){
|
||||
if (expected != cur){
|
||||
FAIL_VALIDATION = 1;
|
||||
printf("[!] Expected %d but got %d, size of %s\n", expected, cur, name);
|
||||
}
|
||||
else{
|
||||
@ -28,4 +31,4 @@ void validate_size(int cur, int expected, const char *name){
|
||||
}
|
||||
|
||||
fflush(stdout);
|
||||
}
|
||||
}
|
||||
|
10
vector.h
10
vector.h
@ -1,11 +1,11 @@
|
||||
// vector.h: interface for the CVector class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#ifndef VECTOR_H
|
||||
#define VECTOR_H
|
||||
|
||||
|
||||
#include "export.h"
|
||||
#include "friction.h"
|
||||
@ -63,3 +63,5 @@ struct SVector {
|
||||
void validate_CVector(void);
|
||||
void validate_CSVector(void);
|
||||
void validate_SVector(void);
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user