Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* public domain */
- /* V2 Builds on Clang & GCC (linux) and TCC (windows) */
- #include <stdint.h>
- #include <stdlib.h>
- #include <string.h>
- #include <stdio.h>
- #define data_size 848U
- #define key_loc 0x1BF
- #define id_loc 0x1DC
- uint8_t rawData[848] = {
- 0, 1, 0, 4,209, 94,165,237, 21,171,225, 26,209, 94,165,237,
- 21,171,225, 26,209, 94,165,237, 21,171,225, 26,209, 94,165,237,
- 21,171,225, 26,209, 94,165,237, 21,171,225, 26,209, 94,165,237,
- 21,171,225, 26,209, 94,165,237, 21,171,225, 26,209, 94,165,237,
- 21,171,225, 26,209, 94,165,237, 21,171,225, 26,209, 94,165,237,
- 21,171,225, 26,209, 94,165,237, 21,171,225, 26,209, 94,165,237,
- 21,171,225, 26,209, 94,165,237, 21,171,225, 26,209, 94,165,237,
- 21,171,225, 26,209, 94,165,237, 21,171,225, 26,209, 94,165,237,
- 21,171,225, 26,209, 94,165,237, 21,171,225, 26,209, 94,165,237,
- 21,171,225, 26,209, 94,165,237, 21,171,225, 26,209, 94,165,237,
- 21,171,225, 26,209, 94,165,237, 21,171,225, 26,209, 94,165,237,
- 21,171,225, 26,209, 94,165,237, 21,171,225, 26,209, 94,165,237,
- 21,171,225, 26,209, 94,165,237, 21,171,225, 26,209, 94,165,237,
- 21,171,225, 26,209, 94,165,237, 21,171,225, 26,209, 94,165,237,
- 21,171,225, 26,209, 94,165,237, 21,171,225, 26,209, 94,165,237,
- 21,171,225, 26,209, 94,165,237, 21,171,225, 26,209, 94,165,237,
- 21,171,225, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 82,111,111,116, 45, 67, 65, 48, 48, 48, 48, 48, 48, 48, 51, 45,
- 88, 83, 48, 48, 48, 48, 48, 48, 48, 99, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 254,237,250,206,254,237,250,206,254,237,250,206,254,237,250,206,
- 254,237,250,206,254,237,250,206,254,237,250,206,254,237,250,206,
- 254,237,250,206,254,237,250,206,254,237,250,206,254,237,250,206,
- 254,237,250,206,254,237,250,206,254,237,250,206, 1, 0, 0,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,255,255,255,
- 255,255,255,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 20, 0, 0, 0,172, 0, 0, 0, 20,
- 0, 1, 0, 20, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0, 1,
- 0, 0, 0,132, 0, 0, 0,132, 0, 3, 0, 0, 0, 0, 0, 0,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- };
- void read_key_string(uint8_t* key_out, char* key_str) {
- if(key_out != NULL && key_str != NULL) {
- uint32_t i;
- for(i=0; i<16; ++i) {
- uint32_t o;
- char str_fix[9];
- memset(str_fix, 0, 9);
- memcpy(str_fix, &key_str[i*2], 2);
- sscanf(str_fix, "%02x", &o);
- key_out[i] = (uint8_t)(o & 0xFF);
- }
- }
- }
- void read_gid_string(uint8_t* gid_out, char* gid_str) {
- if(gid_out != NULL && gid_str != NULL) {
- uint32_t i;
- for(i=0; i<4; ++i) {
- char empty[4];
- memset(empty, 0, 4);
- memcpy(empty, &gid_str[i*2], 2);
- gid_out[i] = (uint8_t)strtoul(empty, NULL, 16);
- }
- for(i=0; i<4; ++i) {
- char empty[4];
- memset(empty, 0, 4);
- memcpy(empty, &gid_str[(i*2)+9], 2);
- gid_out[i+4] = (uint8_t)strtoul(empty, NULL, 16);
- }
- }
- }
- int main(int argc, char** argv) {
- if(argc != 3) {
- printf("Title.tik generator\nOutputs Title.tik with specified data\nUsage: tikmaker.exe XXXXGAME-IDXXXXXX key\n");
- } else {
- FILE* tik;
- uint8_t* gid;
- uint8_t* key;
- key = &rawData[key_loc];
- gid = &rawData[id_loc];
- read_key_string(key, argv[2]);
- read_gid_string(gid, argv[1]);
- tik = fopen("Title.tik", "wb");
- if(tik != NULL) {
- fwrite(rawData, sizeof(char), data_size, tik);
- fclose(tik);
- printf("successfully written Title.tik!\nGame ID: %s\nKey: %s\n", argv[1], argv[2]);
- } else {
- printf("Could not create Title.tik!\n");
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement