Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <unistd.h>
- #include <stdint.h>
- #include <string.h>
- #define BUFFER_SIZE (1024*1024)
- char buffer[BUFFER_SIZE];
- int main(int argc, char* argv[])
- {
- if(argc == 2)
- {
- FILE* file;
- file = fopen(argv[1], "r");
- size_t actual_size = fread(buffer, sizeof(char), BUFFER_SIZE, file);
- printf("Read file size: %u\n", actual_size);
- fclose(file);
- for(int i = 0x10; i < 0x2ee8; i+=8)
- {
- uint16_t* idptr = (uint16_t*)(&buffer[i]);
- if(*idptr != 0)
- {
- // if there is an item ID
- // set it to max
- if(*idptr == 1227)
- break;
- printf("Setting %d from %d to 999.\n", *idptr, *(idptr+1));
- *(idptr+1) = 999;
- }
- }
- file = fopen(strcat(argv[1], "hacked"), "w");
- actual_size = fwrite(buffer, sizeof(char), actual_size, file);
- fclose(file);
- printf("Written file size: %u\n", actual_size);
- }
- else
- {
- fprintf(stderr, "Invalid arguments!\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement