Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
transcs.cpp
Go to the documentation of this file.
1/*
2** Command & Conquer Generals Zero Hour(tm)
3** Copyright 2025 Electronic Arts Inc.
4**
5** This program is free software: you can redistribute it and/or modify
6** it under the terms of the GNU General Public License as published by
7** the Free Software Foundation, either version 3 of the License, or
8** (at your option) any later version.
9**
10** This program is distributed in the hope that it will be useful,
11** but WITHOUT ANY WARRANTY; without even the implied warranty of
12** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13** GNU General Public License for more details.
14**
15** You should have received a copy of the GNU General Public License
16** along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19//
20// transcs.cpp
21//
22
23#include "stdafx.h"
24#include <windows.h>
25#include <winnls.h>
26#include <stdio.h>
27#include <stdlib.h>
28#include <string.h>
29#include <memory.h>
30
32{
33 int i;
34 FILE *out;
35 unsigned short wc;
36 unsigned short mb;
37 DWORD last_error;
38
39 if ( ! ( out = fopen ( "utable.c", "wt" )))
40 {
41 return;
42 }
43
44
45 fprintf (out, "static unsigned short Utable[0x10000] =\n{" );
46
47 for ( i = 0; i < 0x10000; i++ )
48 {
49
50 if ( ( i %32 ) == 0 )
51 {
52 fprintf ( out, "\n\t/* 0x%04x */\t", i );
53 }
54
55 mb = i;
56 if ( MultiByteToWideChar (CP_ACP, MB_ERR_INVALID_CHARS, (LPCSTR) &mb, 2, &wc, 2 ) == 0 )
57 {
58 wc = 0;
59 last_error = GetLastError ( );
60 }
61
62 fprintf (out, "0x%04x", wc );
63 if ( i != 0xffff )
64 {
65 fprintf (out, "," );
66 }
67 }
68
69 fprintf ( out, "\n};\n");
70
71 fclose ( out );
72
73}
const char * LPCSTR
Definition bittype.h:62
unsigned long DWORD
Definition bittype.h:57
void CreateTranslationTable(void)
Definition transcs.cpp:31