mirror of
https://github.com/simtactics/mysimulation.git
synced 2025-07-04 13:47:04 -04:00
Added prerelease version of libvitaboy 1.0.1
This commit is contained in:
parent
432d12397c
commit
a4a7b82bb7
10 changed files with 281 additions and 96 deletions
|
@ -1 +1,3 @@
|
|||
add_subdirectory(FARDive)
|
||||
add_subdirectory(FARDive)
|
||||
add_subdirectory(iff2html)
|
||||
add_subdirectory(misc)
|
0
Tools/iff2html/CMakeLists.txt
Normal file
0
Tools/iff2html/CMakeLists.txt
Normal file
109
Tools/iff2html/iff2html.c
Normal file
109
Tools/iff2html/iff2html.c
Normal file
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
iff2html.c - Copyright (c) 2012 Fatbag <X-Fi6@phppoll.org>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <windows.h>
|
||||
#include "iff.h"
|
||||
|
||||
int main(int argc, char *argv[]){
|
||||
HANDLE hFile;
|
||||
int overwrite = 0;
|
||||
char *InFile, *OutDirectory;
|
||||
HANDLE ProcessHeap = GetProcessHeap();
|
||||
DWORD FileSize;
|
||||
DWORD bytestransferred = 0;
|
||||
uint8_t * IFFData;
|
||||
unsigned chunkcount, chunk = 0;
|
||||
IFFFile * IFFFileInfo;
|
||||
IFFChunkNode * ChunkNode;
|
||||
|
||||
if(argc == 1 || !strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")){
|
||||
printf("Usage: iff2html [-f] infile outfile\n"
|
||||
"Produce an HTML webpage describing an EA IFF file.\n"
|
||||
"Use -f to force overwriting without confirmation.\n"
|
||||
"\n"
|
||||
"Report bugs to <X-Fi6@phppoll.org>.\n"
|
||||
"iff2html is maintained by the Niotso project.\n"
|
||||
"Home page: <http://www.niotso.org/>\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(argc >= 4 && !strcmp(argv[1], "-f")){
|
||||
overwrite++;
|
||||
InFile = argv[2];
|
||||
OutDirectory = argv[3];
|
||||
}else{
|
||||
InFile = argv[1];
|
||||
OutDirectory = argv[2];
|
||||
}
|
||||
|
||||
/****
|
||||
** Open the file and read in entire contents to memory
|
||||
*/
|
||||
|
||||
hFile = CreateFile(InFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL);
|
||||
if(hFile == INVALID_HANDLE_VALUE){
|
||||
if(GetLastError() == ERROR_FILE_NOT_FOUND){
|
||||
printf("%sThe specified input file does not exist.", "iff2html: error: ");
|
||||
return -1;
|
||||
}
|
||||
printf("%sThe input file could not be opened for reading.", "iff2html: error: ");
|
||||
return -1;
|
||||
}
|
||||
FileSize = GetFileSize(hFile, NULL);
|
||||
if(FileSize < 64){
|
||||
printf("%sNot a valid IFF file.", "iff2html: error: ");
|
||||
return -1;
|
||||
}
|
||||
IFFData = HeapAlloc(ProcessHeap, HEAP_NO_SERIALIZE, FileSize);
|
||||
if(IFFData == NULL){
|
||||
printf("%sMemory for this file could not be allocated.", "iff2html: error: ");
|
||||
return -1;
|
||||
}
|
||||
if(!ReadFile(hFile, IFFData, FileSize, &bytestransferred, NULL) || bytestransferred != FileSize){
|
||||
printf("%sThe input file could not be read.", "iff2html: error: ");
|
||||
return -1;
|
||||
}
|
||||
CloseHandle(hFile);
|
||||
|
||||
/****
|
||||
** Load header information
|
||||
*/
|
||||
|
||||
IFFFileInfo = iff_create();
|
||||
if(IFFFileInfo == NULL){
|
||||
printf("%sMemory for this file could not be allocated.", "iff2html: error: ");
|
||||
return -1;
|
||||
}
|
||||
if(!iff_read_header(IFFFileInfo, IFFData, FileSize)){
|
||||
printf("%sNot a valid IFF file.", "iff2html: error: ");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/****
|
||||
** Load entry information
|
||||
*/
|
||||
|
||||
if(!iff_enumerate_chunks(IFFFileInfo, IFFData+64, FileSize-64)){
|
||||
printf("%sChunk data is corrupt.", "iff2html: error: ");
|
||||
return -1;
|
||||
}
|
||||
|
||||
chunkcount = IFFFileInfo->ChunkCount;
|
||||
|
||||
return 0;
|
||||
}
|
45
Tools/iff2html/output.html
Normal file
45
Tools/iff2html/output.html
Normal file
|
@ -0,0 +1,45 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="Content-Style-Type" content="text/css; charset=utf-8" />
|
||||
<meta http-equiv="Content-Language" content="en" />
|
||||
<meta name="description" content="behavior.iff (iff2html)" />
|
||||
<title>behavior.iff (iff2html)</title>
|
||||
<style type="text/css" media="all">
|
||||
html, body {
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
a:link, a:visited, a:hover; a:active { color: #00f; }
|
||||
a:link, a:visited { text-decoration: none; }
|
||||
a:hover, a:active { text-decoration: underline; }
|
||||
|
||||
#toc {
|
||||
display: table-cell;
|
||||
margin-top: 1em;
|
||||
background: #eee; border: 1px solid #bbb;
|
||||
padding: .25em;
|
||||
}
|
||||
#toc ul {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
}
|
||||
ul ul {
|
||||
padding: 2em;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>behavior.iff</h1>
|
||||
<div style="border-left: 2px solid #888; padding-left: 4px; margin-bottom: 1em">
|
||||
<div>9809b96803833f2891ddd31e474795a9 (md5), 42.4kB (43,446 bytes)</div>
|
||||
<div>Dumped by iff2html.</div></div>
|
||||
|
||||
<div id="toc"><div><b>Contents</b> – x chunks</div>
|
||||
<ul>
|
||||
<li><a href="#">1 [STR#] (00DD) – neighbor data labels</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue