mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 06:15:37 +03:00
Ditch amxxpc64. AMXX files will now only contain 32-bit code.
This commit is contained in:
parent
6c22cb171d
commit
6e4f09366e
@ -48,9 +48,9 @@ int main(int argc, char **argv)
|
|||||||
if (!lib)
|
if (!lib)
|
||||||
{
|
{
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
printf("32bit compiler failed to instantiate: %s\n", dlerror());
|
printf("compiler failed to instantiate: %s\n", dlerror());
|
||||||
#else
|
#else
|
||||||
printf("32bit compiler failed to instantiate: %d\n", GetLastError());
|
printf("compiler failed to instantiate: %d\n", GetLastError());
|
||||||
#endif
|
#endif
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
@ -61,9 +61,9 @@ int main(int argc, char **argv)
|
|||||||
if (!sc32 || !pc_printf)
|
if (!sc32 || !pc_printf)
|
||||||
{
|
{
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
printf("32bit compiler failed to link: %p.\n",sc32);
|
printf("compiler failed to link: %p.\n",sc32);
|
||||||
#else
|
#else
|
||||||
printf("32bit compiler failed to link: %d.\n", GetLastError());
|
printf("compiler failed to link: %d.\n", GetLastError());
|
||||||
#endif
|
#endif
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
@ -112,61 +112,12 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
unlink(file);
|
unlink(file);
|
||||||
|
|
||||||
HINSTANCE lib64 = NULL;
|
|
||||||
#ifdef __linux__
|
|
||||||
if (FileExists("./amxxpc64.so"))
|
|
||||||
lib64 = dlmount("./amxxpc64.so");
|
|
||||||
else
|
|
||||||
lib64 = dlmount("amxxpc64.so");
|
|
||||||
#else
|
|
||||||
lib64 = dlmount("amxxpc64.dll");
|
|
||||||
#endif
|
|
||||||
if (!lib64)
|
|
||||||
{
|
|
||||||
pc_printf("64bit compiler failed to instantiate.\n");
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
COMPILER sc64 = (COMPILER)dlsym(lib64, "Compile64");
|
|
||||||
|
|
||||||
if (!sc64)
|
|
||||||
{
|
|
||||||
#ifdef __linux__
|
|
||||||
pc_printf("64bit compiler failed to link: %s.\n", dlerror());
|
|
||||||
#else
|
|
||||||
pc_printf("64bit compiler failed to link: %d.\n", GetLastError());
|
|
||||||
#endif
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
sc64(argc, argv);
|
|
||||||
|
|
||||||
dlclose(lib64);
|
|
||||||
|
|
||||||
if (file == NULL)
|
|
||||||
{
|
|
||||||
pc_printf("Could not locate the output file on second pass.\n");
|
|
||||||
exit(0);
|
|
||||||
} else {
|
|
||||||
FILE *fp = fopen(file, "rb");
|
|
||||||
if (fp == NULL)
|
|
||||||
{
|
|
||||||
pc_printf("Could not locate output file on second pass (compile failed).\n");
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
ReadFileIntoPl(&pl64, fp);
|
|
||||||
pl64.cellsize = 8;
|
|
||||||
fclose(fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////
|
/////////////
|
||||||
// COMPRSSION
|
// COMPRSSION
|
||||||
/////////////
|
/////////////
|
||||||
|
|
||||||
CompressPl(&pl32);
|
CompressPl(&pl32);
|
||||||
|
|
||||||
CompressPl(&pl64);
|
|
||||||
|
|
||||||
char *newfile = new char[strlen(file)+3];
|
char *newfile = new char[strlen(file)+3];
|
||||||
strcpy(newfile, file);
|
strcpy(newfile, file);
|
||||||
if (!strstr(file, ".amxx") && !strstr(file, ".AMXX"))
|
if (!strstr(file, ".amxx") && !strstr(file, ".AMXX"))
|
||||||
@ -179,34 +130,33 @@ int main(int argc, char **argv)
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
BinPlugin bh32, bh64;
|
BinPlugin bh32;
|
||||||
|
|
||||||
Pl2Bh(&pl32, &bh32);
|
Pl2Bh(&pl32, &bh32);
|
||||||
Pl2Bh(&pl64, &bh64);
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
|
static const int kEntries = 1;
|
||||||
|
|
||||||
|
//entry is 4 ints and a byte
|
||||||
|
static const int kEntrySize = (sizeof(int32_t) * 4) + sizeof(int8_t);
|
||||||
|
|
||||||
BinaryWriter bw(fp);
|
BinaryWriter bw(fp);
|
||||||
|
|
||||||
bw.WriteUInt32(MAGIC_HEADER2);
|
bw.WriteUInt32(MAGIC_HEADER2);
|
||||||
bw.WriteUInt16(MAGIC_VERSION);
|
bw.WriteUInt16(MAGIC_VERSION);
|
||||||
bw.WriteUInt8(2);
|
bw.WriteUInt8(kEntries);
|
||||||
|
|
||||||
//base header
|
//base header
|
||||||
int baseaddr = sizeof(int32_t) + sizeof(int16_t) + sizeof(int8_t);
|
int baseaddr = sizeof(int32_t) + sizeof(int16_t) + sizeof(int8_t);
|
||||||
//entry is 4 ints and a byte
|
//extend this by the entries we have
|
||||||
int entrysize = (sizeof(int32_t) * 4) + sizeof(int8_t);
|
baseaddr += kEntrySize * kEntries;
|
||||||
//extend this by the two entries we have
|
|
||||||
baseaddr += entrysize * 2;
|
|
||||||
|
|
||||||
bh32.offs = baseaddr;
|
bh32.offs = baseaddr;
|
||||||
bh64.offs = bh32.offs + bh32.disksize;
|
|
||||||
|
|
||||||
WriteBh(&bw, &bh32);
|
WriteBh(&bw, &bh32);
|
||||||
WriteBh(&bw, &bh64);
|
|
||||||
bw.WriteChars(pl32.cmp, pl32.cmpsize);
|
bw.WriteChars(pl32.cmp, pl32.cmpsize);
|
||||||
bw.WriteChars(pl64.cmp, pl64.cmpsize);
|
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
unlink(file);
|
unlink(file);
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
OPT_FLAGS = -O3 -funroll-loops -s -pipe -fno-strict-aliasing -fvisibility=hidden
|
OPT_FLAGS = -O3 -funroll-loops -s -pipe -fno-strict-aliasing -fvisibility=hidden
|
||||||
DEBUG_FLAGS = -g -ggdb3
|
DEBUG_FLAGS = -g -ggdb3
|
||||||
CPP = gcc-4.1
|
CPP = gcc-4.1
|
||||||
NAME = amxxpc
|
NAME = amxxpc32
|
||||||
|
|
||||||
OBJECTS = sc1.c sc2.c sc3.c sc4.c sc5.c sc6.c sc7.c scvars.c scmemfil.c \
|
OBJECTS = sc1.c sc2.c sc3.c sc4.c sc5.c sc6.c sc7.c scvars.c scmemfil.c \
|
||||||
scstate.c sclist.c sci18n.c scexpand.c pawncc.c libpawnc.c prefix.c \
|
scstate.c sclist.c sci18n.c scexpand.c pawncc.c libpawnc.c prefix.c \
|
||||||
@ -16,15 +16,9 @@ LINK = -lpthread
|
|||||||
|
|
||||||
INCLUDE = -I.
|
INCLUDE = -I.
|
||||||
|
|
||||||
ifeq "$(PAWN64)" "true"
|
BINARY = $(NAME).so
|
||||||
BINARY = $(NAME)64.so
|
BIN_DIR = Release
|
||||||
BIN_DIR = Release64
|
CFLAGS += -DPAWN_CELL_SIZE=32
|
||||||
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -Dpc_printf=pc_printf64
|
|
||||||
else
|
|
||||||
BINARY = $(NAME)32.so
|
|
||||||
BIN_DIR = Release32
|
|
||||||
CFLAGS += -DPAWN_CELL_SIZE=32
|
|
||||||
endif
|
|
||||||
|
|
||||||
CFLAGS += -DLINUX -DNDEBUG -DHAVE_STDINT_H -DENABLE_BINRELOC -DNO_MAIN -DPAWNC_DLL -static-libgcc
|
CFLAGS += -DLINUX -DNDEBUG -DHAVE_STDINT_H -DENABLE_BINRELOC -DNO_MAIN -DPAWNC_DLL -static-libgcc
|
||||||
|
|
||||||
@ -35,10 +29,8 @@ $(BIN_DIR)/%.o: %.c
|
|||||||
$(CPP) $(INCLUDE) $(CFLAGS) -m32 -o $@ -c $<
|
$(CPP) $(INCLUDE) $(CFLAGS) -m32 -o $@ -c $<
|
||||||
|
|
||||||
all:
|
all:
|
||||||
mkdir -p Release32
|
mkdir -p Release
|
||||||
mkdir -p Release64
|
|
||||||
$(MAKE) pawn_make
|
$(MAKE) pawn_make
|
||||||
$(MAKE) pawn_make PAWN64=true
|
|
||||||
|
|
||||||
pawn_make: $(OBJ_LINUX)
|
pawn_make: $(OBJ_LINUX)
|
||||||
$(CPP) $(INCLUDE) $(CFLAGS) -m32 $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
|
$(CPP) $(INCLUDE) $(CFLAGS) -m32 $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
|
||||||
@ -49,8 +41,6 @@ debug:
|
|||||||
default: all
|
default: all
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf Release32/*.o
|
rm -rf Release/*.o
|
||||||
rm -rf Release32/$(BINARY)
|
rm -rf Release/$(BINARY)
|
||||||
rm -rf Release64/*.o
|
|
||||||
rm -rf Release64/$(BINARY)
|
|
||||||
|
|
||||||
|
@ -208,8 +208,6 @@ Section "MainSection" SEC01
|
|||||||
File "installer\files\base\addons\amxmodx\scripting\amxxpc.exe"
|
File "installer\files\base\addons\amxmodx\scripting\amxxpc.exe"
|
||||||
File "installer\files\base\addons\amxmodx\scripting\amxxpc32.dll"
|
File "installer\files\base\addons\amxmodx\scripting\amxxpc32.dll"
|
||||||
File "installer\files\base\addons\amxmodx\scripting\amxxpc32.so"
|
File "installer\files\base\addons\amxmodx\scripting\amxxpc32.so"
|
||||||
File "installer\files\base\addons\amxmodx\scripting\amxxpc64.dll"
|
|
||||||
File "installer\files\base\addons\amxmodx\scripting\amxxpc64.so"
|
|
||||||
File "installer\files\base\addons\amxmodx\scripting\antiflood.sma"
|
File "installer\files\base\addons\amxmodx\scripting\antiflood.sma"
|
||||||
File "installer\files\base\addons\amxmodx\scripting\cmdmenu.sma"
|
File "installer\files\base\addons\amxmodx\scripting\cmdmenu.sma"
|
||||||
File "installer\files\base\addons\amxmodx\scripting\compile.exe"
|
File "installer\files\base\addons\amxmodx\scripting\compile.exe"
|
||||||
@ -708,8 +706,6 @@ Section Uninstall
|
|||||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\compile.exe"
|
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\compile.exe"
|
||||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\cmdmenu.sma"
|
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\cmdmenu.sma"
|
||||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\antiflood.sma"
|
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\antiflood.sma"
|
||||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\amxxpc64.so"
|
|
||||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\amxxpc64.dll"
|
|
||||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\amxxpc32.so"
|
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\amxxpc32.so"
|
||||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\amxxpc32.dll"
|
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\amxxpc32.dll"
|
||||||
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\amxxpc.exe"
|
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\amxxpc.exe"
|
||||||
|
Loading…
Reference in New Issue
Block a user