Fix Little-Big endian BAG

This commit is contained in:
german 2026-02-23 11:14:18 +04:00
parent 603d3a87a4
commit b5f8ed9456
2 changed files with 21 additions and 8 deletions

BIN
ntsys

Binary file not shown.

29
ntsys.h
View File

@ -26,6 +26,10 @@
#define NTSYS_VERSION "1.0"
#define NAME_OF_32_BITS_TYPE unsigned int
#define NAME_OF_64_BITS_TYPE unsigned long int
#define NAME_OF_16_BITS_TYPE unsigned short int
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -61,6 +65,10 @@ static void __help(void) {
);
}
static int __exe_run(__e_byte_t* memory, unsigned int memorysize, unsigned long filesize, FILE* fp) {
return EXIT_SUCCESS;
}
int ntsys_api_call(char* filename) {
/* File data */
@ -105,14 +113,19 @@ int ntsys_api_call(char* filename) {
ntsys_error("Header read error or digital signature is invalid!");
return EXIT_FAILURE;
}
/*
* printf("Filesize: %d bytes\n", *((unsigned short int*)head.e_filesize));
* printf("Memorysize: %d bytes\n", *((unsigned short int*)head.e_memorysize));
*/
return EXIT_SUCCESS;
unsigned long int filesize = 0;
switch (4) {
case sizeof(NAME_OF_64_BITS_TYPE): filesize = *((NAME_OF_64_BITS_TYPE*)head.e_filesize); break;
case sizeof(NAME_OF_32_BITS_TYPE): filesize = *((NAME_OF_32_BITS_TYPE*)head.e_filesize); break;
default:
ntsys_error("Unknown data type! You must recompile the program and specify a different type.");
return EXIT_FAILURE;
}
__e_byte_t* memory = malloc(*((NAME_OF_16_BITS_TYPE*)head.e_memorysize));
int stat = __exe_run(memory, (unsigned int)*((NAME_OF_16_BITS_TYPE*)head.e_memorysize), filesize, fp);
fclose(fp);
free(memory);
return stat;
}
int ntsys_compile_asm(char* in_file, char* out_file) {