summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Dalos/Console.cc309
-rw-r--r--Dalos/Console.h63
-rw-r--r--Dalos/Dalos.cc1301
-rw-r--r--MSVC/Baltisot - generic/Baltisot - generic.vcproj1382
-rw-r--r--MSVC/Dalos/Dalos.vcproj252
-rw-r--r--MSVC/PSX-Bundle - library/PSX-Bundle - library.vcproj18
-rw-r--r--MSVC/PSX-Bundle.sln112
-rw-r--r--MSVC/Tools/Tools.vcproj26
-rw-r--r--MSVC/mogltk/mogltk.vcproj418
-rw-r--r--lib/isobuilder.cpp1744
10 files changed, 2910 insertions, 2715 deletions
diff --git a/Dalos/Console.cc b/Dalos/Console.cc
new file mode 100644
index 0000000..9078ef9
--- /dev/null
+++ b/Dalos/Console.cc
@@ -0,0 +1,309 @@
+/*
+ * Dalos
+ * Copyright (C) 2004 Nicolas "Pixel" Noble
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* $Id: Console.cc,v 1.1 2004-10-19 01:27:27 pixel Exp $ */
+
+#include <SDL.h>
+#include <SDL_thread.h>
+
+#include <Exceptions.h>
+#include <BString.h>
+#include <Buffer.h>
+
+#include <readline/readline.h>
+#include <readline/history.h>
+
+#include <glshape.h>
+
+#include <Console.h>
+
+SDL_mutex * console_lock;
+SDL_sem * console_sem;
+Buffer console_buffer;
+
+SDL_mutex * key_vect_mutex;
+SDL_sem * key_vect_size;
+std::vector<Uint16> key_vect;
+
+String console_prompt = "> ";
+
+class ReadLineInternals : public Base {
+ public:
+ static int readline_thread(void * d) {
+ char * line_read;
+ String line, endline;
+ bool runit;
+ int pos;
+
+ rl_getc_function = ReadLineInternals::rl_getc_func;
+ rl_redisplay_function = ReadLineInternals::rl_redisplay_func;
+ rl_prep_term_function = ReadLineInternals::rl_prep_term_func;
+ rl_deprep_term_function = ReadLineInternals::rl_deprep_term_func;
+ rl_bind_key('\t', rl_insert);
+
+ while (true) {
+ line_read = readline("");
+ if (!line_read)
+ continue;
+ if (*line_read)
+ add_history(line_read);
+ CurrentConsole->add_line(console_prompt + line_read);
+
+ line = line_read;
+ line = line.trim();
+ endline = "";
+
+ /* Splitting the line between ;; */
+ while (line.strlen()) {
+ runit = false;
+
+ if ((pos = line.strstr(";;")) >= 0) {
+ endline = line.extract(pos + 2);
+ line = line.extract(0, pos);
+ runit = true;
+ } else {
+ endline = "";
+ }
+
+ if (line[line.strlen() - 1] == '\\') {
+ line[line.strlen() - 1] = ' ';
+ } else if (auto_exec) {
+ runit = true;
+ }
+
+ SDL_mutexP(console_lock);
+ console_buffer << line;
+ SDL_mutexV(console_lock);
+
+ if (runit) {
+ SDL_SemPost(console_sem);
+ prompt = "> ";
+ } else {
+ prompt = "- ";
+ }
+ line = endline.trim();
+ }
+
+ free(line_read);
+ }
+
+ return 0;
+ }
+ private:
+ static int rl_getc_func(FILE * d) {
+ int k;
+ SDL_SemWait(key_vect_size);
+ SDL_mutexP(key_vect_mutex);
+ k = key_vect[0];
+ key_vect.erase(key_vect.begin());
+ SDL_mutexV(key_vect_mutex);
+ return k;
+ }
+
+ static void rl_redisplay_func(void) {
+ CurrentConsole->page_reset();
+ }
+
+ static void rl_prep_term_func(int b) {
+ }
+
+ static void rl_deprep_term_func(void) {
+ }
+};
+
+virtual void console_keyevent::down(SDL_keysym k) {
+ if (Application->Console->GetVisible()) {
+ SDL_mutexP(key_vect_mutex);
+ switch (k.sym) {
+ case SDLK_ESCAPE:
+ Application->Console->SetVisible(false);
+ SDL_mutexV(key_vect_mutex);
+ return;
+ case SDLK_DELETE:
+ key_vect.push_back('D' - '@');
+ break;
+ case SDLK_LEFT:
+ key_vect.push_back('B' - '@');
+ break;
+ case SDLK_RIGHT:
+ key_vect.push_back('F' - '@');
+ break;
+ case SDLK_UP:
+ key_vect.push_back('P' - '@');
+ break;
+ case SDLK_DOWN:
+ key_vect.push_back('N' - '@');
+ break;
+ case SDLK_HOME:
+ key_vect.push_back('A' - '@');
+ break;
+ case SDLK_END:
+ key_vect.push_back('E' - '@');
+ break;
+ case SDLK_PAGEUP:
+ Application->Console->page_up();
+ SDL_mutexV(key_vect_mutex);
+ return;
+ case SDLK_PAGEDOWN:
+ Application->Console->page_down();
+ SDL_mutexV(key_vect_mutex);
+ return;
+ case SDLK_c:
+ if (k.mod & KMOD_CTRL) {
+ if (lua_started)
+ do_lua_break = true;
+ SDL_mutexV(key_vect_mutex);
+ return;
+ }
+ default:
+ if (k.unicode) {
+ switch (k.unicode) {
+ case 0xb4:
+ key_vect.push_back('\'');
+ break;
+ case 0xa8:
+ key_vect.push_back('"');
+ break;
+ default:
+ key_vect.push_back(k.unicode);
+ }
+ } else {
+ SDL_mutexV(key_vect_mutex);
+ if (old_handler)
+ old_handler->down(k);
+ return;
+ }
+ }
+ // hack...
+ if (lua_started)
+ key_vect.pop_back();
+ SDL_mutexV(key_vect_mutex);
+ if (!lua_started)
+ SDL_SemPost(key_vect_size);
+ } else {
+ if (k.sym == SDLK_ESCAPE) {
+ CurrentConsole->SetVisible(true);
+ return;
+ }
+ if (old_handler)
+ old_handler->down(k);
+ }
+}
+
+void console_keyevent::up(SDL_keysym k) {
+ if (old_handler)
+ old_handler->up(k);
+}
+
+console::console(mogltk::shape * sh, mogltk::widget * father, int y, int _nlines) :
+ widget(father, 0, y, father->GetW(), _nlines * 13, 0, "console", sh), nlines(_nlines), page(0), protect_add_line(SDL_CreateMutex()) {
+ SetVisible(false);
+}
+
+console::~console() {
+ SDL_DestroyMutex(protect_add_line);
+}
+
+void console::add_line(const String & s) {
+ SDL_mutexP(protect_add_line);
+ lines.insert(lines.begin(), 1, s);
+ while (lines.size() >= 1024) {
+ lines.pop_back();
+ }
+ SDL_mutexV(protect_add_line);
+}
+
+void console::page_reset() {
+ page = 0;
+}
+
+void console::page_up() {
+ page += nlines - 1;
+ if (page > (lines.size() - nlines))
+ page = lines.size() - nlines;
+}
+
+void console::page_down() {
+ page -= nlines - 1;
+ if (page < 0)
+ page = 0;
+}
+
+void console::draw() {
+ int cursor_pos, start, line_length, line_pos, cur_page;
+
+ mogltk::ColorP::Max.A = 180;
+ std::vector<String>::iterator i;
+
+ // Background
+ Shaper()->box(GetAX(), GetAY(), GetAX2(), GetAY2(), DODGERBLUE);
+ Shaper()->obox(GetAX(), GetAY(), GetAX2(), GetAY2(), BLUE);
+
+ mogltk::ColorP::Max.A = 255;
+ mogltk::FixedFont->setcolor(WHITE);
+
+ // Lines
+ SDL_mutexP(protect_add_line);
+ i = lines.begin();
+ for (cur_page = page; cur_page && (i != lines.end()); cur_page--, i++);
+
+ for (line_pos = nlines - 2; (line_pos >= 0) && (i != lines.end()); line_pos--, i++) {
+ const char * line;
+ mogltk::FixedFont->putcursor(GetAX(), GetAY() + line_pos * 13);
+ line = i->to_charp();
+ mogltk::FixedFont->printf("%s", line);
+ }
+ SDL_mutexV(protect_add_line);
+
+ // Cursor
+ cursor_pos = rl_point;
+ start = 0;
+
+ line_length = strlen(rl_line_buffer);
+
+// while ((((cursor_pos + 2) * 6) >= GetW() || (((line_length - start + 2) * 6) >= GetW())) && (cursor_pos >= 16)) {
+ while (((cursor_pos + 2) * 6) >= GetW()) {
+ cursor_pos -= 16;
+ start += 16;
+ }
+
+ mogltk::ColorP::Max.A = 220;
+
+ if (lua_started) {
+ Shaper()->box(GetAX(), GetAY() + (nlines - 1) * 13, GetAX() + 6, GetAY() + nlines * 13, FORESTGREEN);
+ } else {
+ Shaper()->box(GetAX() + 6 * (cursor_pos + 2), GetAY() + (nlines - 1) * 13, GetAX() + 6 * (cursor_pos + 3) - 1, GetAY() + nlines * 13, FORESTGREEN);
+
+ mogltk::ColorP::Max.A = 255;
+ mogltk::FixedFont->putcursor(GetAX(), GetAY() + (nlines - 1) * 13);
+ mogltk::FixedFont->printf(prompt);
+ mogltk::FixedFont->printf("%s", rl_line_buffer + start);
+ }
+}
+
+bool console::process_event(int mx, int my, mogltk::event_t event) {
+ return false;
+}
+
+void create_console_thread {
+ key_vect_mutex = SDL_CreateMutex();
+ key_vect_size = SDL_CreateSemaphore(0);
+
+ SDL_CreateThread(readline_thread, 0);
+}
diff --git a/Dalos/Console.h b/Dalos/Console.h
new file mode 100644
index 0000000..5a632fa
--- /dev/null
+++ b/Dalos/Console.h
@@ -0,0 +1,63 @@
+/*
+ * Dalos
+ * Copyright (C) 2004 Nicolas "Pixel" Noble
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* $Id: Console.h,v 1.1 2004-10-19 01:27:27 pixel Exp $ */
+
+#ifndef __CONSOLE_H__
+#define __CONSOLE_H__
+
+#include <SDL.h>
+#include <SDL_Thread.h>
+
+#include <Buffer.h>
+
+#include <engine.h>
+#include <widgets.h>
+
+class console_keyevent : public mogltk::engine::keyevent {
+ public:
+ virtual void down(SDL_keysym k);
+ virtual void up(SDL_keysym k);
+};
+
+class console : public mogltk::widget {
+ public:
+ console(mogltk::shape * sh, mogltk::widget * father, int y, int _nlines);
+ virtual ~console();
+ void add_line(const String & s);
+ void page_reset();
+ void page_up();
+ void page_down();
+ protected:
+ virtual void draw();
+ virtual bool process_event(int mx, int my, mogltk::event_t event);
+ private:
+ int nlines, page;
+ std::vector<String> lines;
+ SDL_mutex * protect_add_line;
+} * CurrentConsole;
+
+extern SDL_mutex * console_lock;
+extern SDL_sem * console_sem;
+extern Buffer console_buffer;
+
+extern String console_prompt;
+
+
+#endif
diff --git a/Dalos/Dalos.cc b/Dalos/Dalos.cc
index 0186cb3..7e49660 100644
--- a/Dalos/Dalos.cc
+++ b/Dalos/Dalos.cc
@@ -1,775 +1,526 @@
-/*
- * Dalos
- * Copyright (C) 2004 Nicolas "Pixel" Noble
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/* $Id: Dalos.cc,v 1.6 2004-08-01 13:03:47 pixel Exp $ */
-
-#include <SDL.h>
-#include <SDL_thread.h>
-
-#include <readline/readline.h>
-#include <readline/history.h>
-
-#include <vector>
-
-#include <Main.h>
-#include <Handle.h>
-#include <Input.h>
-#include <Buffer.h>
-#include <BLua.h>
-#include <LuaHandle.h>
-
-#include <engine.h>
-#include <glbase.h>
-#include <glshape.h>
-#include <font.h>
-
-#include <luacd.h>
-#include <luapsx.h>
-
-#include "cd-tool-hc.h"
-
-#ifdef __MINGW32__
-#define main SDL_main
-#endif
-
-bool auto_exec = true;
-bool lua_started = false;
-bool do_lua_break = false;
-
-String prompt = "> ";
-
-SDL_mutex * lua_command_lock;
-SDL_sem * lua_command_sem;
-Buffer lua_command;
-
-SDL_mutex * key_vect_mutex;
-SDL_sem * key_vect_size;
-std::vector<Uint16> key_vect;
-
-CODE_BEGINS
-
-class hexview;
-
-hexview * hexviewer;
-
-class console;
-
-console * Console;
-
-mogltk::widgets::Root * Root;
-mogltk::widget * Frame;
-mogltk::widgets::Menu * MainMenu;
-
-class threaded_Lua : public Lua {
- public:
- threaded_Lua() : mutex(SDL_CreateMutex()) { }
- virtual ~threaded_Lua() { SDL_DestroyMutex(mutex); }
- virtual void lock() {
- SDL_mutexP(mutex);
- }
- virtual void unlock() {
- SDL_mutexV(mutex);
- }
- private:
- SDL_mutex * mutex;
-};
-
-class threaded_locker : public locker_t {
- public:
- threaded_locker() : mutex(SDL_CreateMutex()) { }
- virtual ~threaded_locker() { SDL_DestroyMutex(mutex); }
- virtual void lock() {
- SDL_mutexP(mutex);
- }
- virtual void unlock() {
- SDL_mutexV(mutex);
- }
- private:
- SDL_mutex * mutex;
-};
-
-static int lua_print(lua_State * _L) {
- Lua * L = Lua::find(_L);
- String t = L->tostring() + "\n";
- char * tc = t.strdup();
-
- printm(M_STATUS, "%s", tc);
-
- free(tc);
-
- return 0;
-}
-
-static void lua_hook(lua_State * _L, lua_Debug * ar) {
- if (!lua_started)
- return;
- Lua * L = Lua::find(_L);
-
- if (do_lua_break) {
- L->do_break();
- do_lua_break = false;
- }
-}
-
-static int rl_getc_func(FILE * d) {
- int k;
- SDL_SemWait(key_vect_size);
- SDL_mutexP(key_vect_mutex);
- k = key_vect[0];
- key_vect.erase(key_vect.begin());
- SDL_mutexV(key_vect_mutex);
- return k;
-}
-
-static void rl_redisplay_func(void) {
- Application->Console->page_reset();
-}
-
-static void rl_prep_term_func(int b) {
-}
-
-static void rl_deprep_term_func(void) {
-}
-
-static int readline_thread(void * d) {
- char * line_read;
- String line, endline;
- bool runit;
- int pos;
-
- rl_getc_function = rl_getc_func;
- rl_redisplay_function = rl_redisplay_func;
- rl_prep_term_function = rl_prep_term_func;
- rl_deprep_term_function = rl_deprep_term_func;
- rl_bind_key('\t', rl_insert);
-
- while (true) {
- line_read = readline("");
- if (!line_read)
- continue;
- if (*line_read)
- add_history(line_read);
- Application->Console->add_line(prompt + line_read);
-
- line = line_read;
- line = line.trim();
- endline = "";
-
- /* Splitting the line between ;; */
- while (line.strlen()) {
- runit = false;
-
- if ((pos = line.strstr(";;")) >= 0) {
- endline = line.extract(pos + 2);
- line = line.extract(0, pos);
- runit = true;
- } else {
- endline = "";
- }
-
- if (line[line.strlen() - 1] == '\\') {
- line[line.strlen() - 1] = ' ';
- } else if (auto_exec) {
- runit = true;
- }
-
- SDL_mutexP(lua_command_lock);
- lua_command << line;
- SDL_mutexV(lua_command_lock);
-
- if (runit) {
- SDL_SemPost(lua_command_sem);
- prompt = "> ";
- } else {
- prompt = "- ";
- }
- line = endline.trim();
- }
-
- free(line_read);
- }
-
- return 0;
-}
-
-void start_lua() {
- Lua * L = new threaded_Lua();
- Buffer built;
- bool use_builtin_cdtool = false;
- int i;
-
- L->open_base();
- L->open_math();
- L->open_string();
- L->open_table();
-
- LuaInput::pushconstruct(L);
- LuaOutput::pushconstruct(L);
- LuaBuffer::pushconstruct(L);
-
- CD_PUSHSTATICS(L);
- Luapsx::pushstatics(L);
-
- L->push("print");
- L->push(lua_print);
- L->setvar();
-
- L->sethook(lua_hook, LUA_MASKLINE, 0);
-
- lua_command_lock = SDL_CreateMutex();
- lua_command_sem = SDL_CreateSemaphore(0);
-
- try {
- L->load(&Input("cd-tool.lua"));
- } catch (GeneralException e) {
- printm(M_WARNING, "There was an error loading cd-tool.lua: %s, using built-in.\n", e.GetMsg());
- use_builtin_cdtool = true;
- }
-
- if (use_builtin_cdtool) {
- for (i = 0; i < cd_tool_lua_size; i++) {
- built.writeU8(cd_tool_lua[i]);
- }
- try {
- L->load(&built);
- }
- catch (GeneralException e) {
- printm(M_WARNING, "There was an error loading built-in cd-tool.lua: %s\n", e.GetMsg());
- }
- }
-
- SDL_CreateThread(LuaThread, L);
-}
-
-static int LuaThread(void * d) {
- Lua * L = (Lua *) d;
- while (true) {
- SDL_SemWait(lua_command_sem);
- lua_started = true;
- SDL_mutexP(lua_command_lock);
- try {
- L->load(&lua_command);
- }
- catch (LuaException e) {
- /* If there was an error, ignore it, and free the stack */
- while(L->gettop())
- L->pop();
- }
- catch (GeneralException e) {
- /* A more severe exception... */
- while(L->gettop())
- L->pop();
- printm(M_ERROR, "Aborted. LUA caused the following exception: %s\n", e.GetMsg());
- }
- SDL_mutexV(lua_command_lock);
- lua_started = false;
- }
-}
-
-class console_keyevent : public mogltk::engine::keyevent {
- public:
- virtual void down(SDL_keysym k) {
- if (Application->Console->GetVisible()) {
- SDL_mutexP(key_vect_mutex);
- switch (k.sym) {
- case SDLK_ESCAPE:
- Application->Console->SetVisible(false);
- SDL_mutexV(key_vect_mutex);
- return;
- case SDLK_DELETE:
- key_vect.push_back('D' - '@');
- break;
- case SDLK_LEFT:
- key_vect.push_back('B' - '@');
- break;
- case SDLK_RIGHT:
- key_vect.push_back('F' - '@');
- break;
- case SDLK_UP:
- key_vect.push_back('P' - '@');
- break;
- case SDLK_DOWN:
- key_vect.push_back('N' - '@');
- break;
- case SDLK_HOME:
- key_vect.push_back('A' - '@');
- break;
- case SDLK_END:
- key_vect.push_back('E' - '@');
- break;
- case SDLK_PAGEUP:
- Application->Console->page_up();
- SDL_mutexV(key_vect_mutex);
- return;
- case SDLK_PAGEDOWN:
- Application->Console->page_down();
- SDL_mutexV(key_vect_mutex);
- return;
- case SDLK_c:
- if (k.mod & KMOD_CTRL) {
- if (lua_started)
- do_lua_break = true;
- SDL_mutexV(key_vect_mutex);
- return;
- }
- default:
- if (k.unicode) {
- switch (k.unicode) {
- case 0xb4:
- key_vect.push_back('\'');
- break;
- case 0xa8:
- key_vect.push_back('"');
- break;
- default:
- key_vect.push_back(k.unicode);
- }
- } else {
- SDL_mutexV(key_vect_mutex);
- if (old_handler)
- old_handler->down(k);
- return;
- }
- }
- // hack...
- if (lua_started)
- key_vect.pop_back();
- SDL_mutexV(key_vect_mutex);
- if (!lua_started)
- SDL_SemPost(key_vect_size);
- } else {
- if (k.sym == SDLK_ESCAPE) {
- Application->Console->SetVisible(true);
- return;
- }
- if (old_handler)
- old_handler->down(k);
- }
- }
- virtual void up(SDL_keysym k) {
- if (old_handler)
- old_handler->up(k);
- }
-};
-
-class hexview_keyevent : public mogltk::engine::keyevent {
- public:
- virtual void down(SDL_keysym k) {
- if (!Application->hexviewer || !Application->hexviewer->GetVisible()) {
- if (old_handler)
- old_handler->down(k);
- return;
- }
- switch (k.sym) {
- case SDLK_DOWN:
- Application->hexviewer->change_offset(Application->hexviewer->get_offset() + Application->hexviewer->get_width());
- break;
- case SDLK_UP:
- Application->hexviewer->change_offset(Application->hexviewer->get_offset() - Application->hexviewer->get_width());
- break;
- case SDLK_RIGHT:
- if (KMOD_ALT & k.mod) {
- Application->hexviewer->change_width(Application->hexviewer->get_width() + 1);
- } else if (KMOD_CTRL & k.mod) {
- Application->hexviewer->change_shift(Application->hexviewer->get_shift() - 1);
- } else {
- Application->hexviewer->change_offset(Application->hexviewer->get_offset() + 1);
- }
- break;
- case SDLK_LEFT:
- if (KMOD_ALT & k.mod) {
- Application->hexviewer->change_width(Application->hexviewer->get_width() - 1);
- } else if (KMOD_CTRL & k.mod) {
- Application->hexviewer->change_shift(Application->hexviewer->get_shift() + 1);
- } else {
- Application->hexviewer->change_offset(Application->hexviewer->get_offset() - 1);
- }
- break;
- case SDLK_PAGEDOWN:
- Application->hexviewer->change_offset(Application->hexviewer->get_offset() + Application->hexviewer->get_width() * Application->hexviewer->get_nlines());
- break;
- case SDLK_PAGEUP:
- Application->hexviewer->change_offset(Application->hexviewer->get_offset() - Application->hexviewer->get_width() * Application->hexviewer->get_nlines());
- break;
- case SDLK_HOME:
- Application->hexviewer->change_offset(0);
- break;
- case SDLK_END:
- Application->hexviewer->change_offset(Application->hexviewer->get_size() - 1);
- break;
- default:
- if (old_handler)
- old_handler->down(k);
- return;
- }
- }
- virtual void up(SDL_keysym k) {
- if (old_handler)
- old_handler->up(k);
- }
-};
-
-class myprinter : public printer_t {
- public:
- myprinter() : lock(SDL_CreateMutex()) { }
- virtual ~myprinter() { SDL_DestroyMutex(lock); }
- virtual bool printm(int level, const char * m, va_list ap) {
- static String heads[] = {"EE", "--", "WW", "II"};
- static char buffer[20480];
-
- if (level >= M_INFO)
- return true;
-
- SDL_mutexP(lock);
-
- vsprintf(buffer, m, ap);
- if (level >= 0)
- Application->Console->add_line("(" + heads[level] + ") " + buffer);
- else
- Application->Console->add_line(buffer);
-
- SDL_mutexV(lock);
-
- return true;
- }
- private:
- SDL_mutex * lock;
-};
-
-class console : public mogltk::widget {
- public:
- console(mogltk::shape * sh, mogltk::widget * father, int y, int _nlines) :
- widget(father, 0, y, father->GetW(), _nlines * 13, 0, "console", sh), nlines(_nlines), page(0), protect_add_line(SDL_CreateMutex()) { SetVisible(false); }
- virtual ~console() { SDL_DestroyMutex(protect_add_line); }
- void add_line(const String & s) {
- SDL_mutexP(protect_add_line);
- lines.insert(lines.begin(), 1, s);
- while (lines.size() >= 1024) {
- lines.pop_back();
- }
- SDL_mutexV(protect_add_line);
- }
- void page_reset() {
- page = 0;
- }
- void page_up() {
- page += nlines - 1;
- if (page > (lines.size() - nlines))
- page = lines.size() - nlines;
- }
- void page_down() {
- page -= nlines - 1;
- if (page < 0)
- page = 0;
- }
- protected:
- virtual void draw() {
- int cursor_pos, start, line_length, line_pos, cur_page;
-
- mogltk::ColorP::Max.A = 180;
- std::vector<String>::iterator i;
-
- // Background
- Shaper()->box(GetAX(), GetAY(), GetAX2(), GetAY2(), DODGERBLUE);
- Shaper()->obox(GetAX(), GetAY(), GetAX2(), GetAY2(), BLUE);
-
- mogltk::ColorP::Max.A = 255;
- mogltk::FixedFont->setcolor(WHITE);
-
- // Lines
- SDL_mutexP(protect_add_line);
- i = lines.begin();
- for (cur_page = page; cur_page && (i != lines.end()); cur_page--, i++);
-
- for (line_pos = nlines - 2; (line_pos >= 0) && (i != lines.end()); line_pos--, i++) {
- const char * line;
- mogltk::FixedFont->putcursor(GetAX(), GetAY() + line_pos * 13);
- line = i->to_charp();
- mogltk::FixedFont->printf("%s", line);
- }
- SDL_mutexV(protect_add_line);
-
- // Cursor
- cursor_pos = rl_point;
- start = 0;
-
- line_length = strlen(rl_line_buffer);
-
-// while ((((cursor_pos + 2) * 6) >= GetW() || (((line_length - start + 2) * 6) >= GetW())) && (cursor_pos >= 16)) {
- while (((cursor_pos + 2) * 6) >= GetW()) {
- cursor_pos -= 16;
- start += 16;
- }
-
- mogltk::ColorP::Max.A = 220;
-
- if (lua_started) {
- Shaper()->box(GetAX(), GetAY() + (nlines - 1) * 13, GetAX() + 6, GetAY() + nlines * 13, FORESTGREEN);
- } else {
- Shaper()->box(GetAX() + 6 * (cursor_pos + 2), GetAY() + (nlines - 1) * 13, GetAX() + 6 * (cursor_pos + 3) - 1, GetAY() + nlines * 13, FORESTGREEN);
-
- mogltk::ColorP::Max.A = 255;
- mogltk::FixedFont->putcursor(GetAX(), GetAY() + (nlines - 1) * 13);
- mogltk::FixedFont->printf(prompt);
- mogltk::FixedFont->printf("%s", rl_line_buffer + start);
- }
- }
- virtual bool process_event(int mx, int my, mogltk::event_t event) {
- return false;
- }
- private:
- int nlines, page;
- std::vector<String> lines;
- SDL_mutex * protect_add_line;
-};
-
-class hexview : public mogltk::widget {
- public:
- hexview(mogltk::shape * sh, mogltk::widget * father) :
- widget(father, 0, 0, father->GetW(), father->GetH(), 0, "hexview", sh), h(0), width(16), offset(0), offset_loaded(-1), size_loaded(0), data(0), virtual_base(0), shift(0)
- { nlines = GetH() / 13; Application->hexviewer = this; }
- virtual ~hexview() { free(data); Application->hexviewer = 0; }
- void set_virtual_base(int _virtual_base) {
- virtual_base = _virtual_base;
- }
- int get_nlines() {
- return nlines;
- }
- int get_size() {
- if (!h)
- return 0;
- return h->GetSize();
- }
- void change_width(int _width) {
- if (_width <= 0)
- _width = 1;
- if (width != _width) {
- free(data);
- width = _width;
- }
- }
- int get_width() {
- return width;
- }
- void change_offset(int _offset) {
- if ((_offset < 0) || !h)
- _offset = 0;
- if (h && (_offset >= h->GetSize()))
- _offset = h->GetSize() - 1;
- offset = _offset;
- }
- int get_offset() {
- return offset;
- }
- void change_shift(int _shift) {
- shift = _shift;
- }
- int get_shift() {
- return shift;
- }
- void bind_handle(Handle * _h) {
- h = _h;
- }
- Uint8 * get_data() {
- if (!data) {
- data = (Uint8 *) malloc(nlines * width);
- }
-
- if ((offset_loaded == offset) && (size_loaded == (nlines * width)))
- return data;
-
- h->seek(offset);
- h->read(data, nlines * width);
-
- offset_loaded = offset;
- size_loaded = nlines * width;
-
- return data;
- }
- virtual void draw() {
- int i, max_o, j, k, start_o, l, c;
-
- if (!h)
- return;
-
- get_data();
-
- mogltk::FixedFont->setcolor(WHITE);
- mogltk::FixedFont->putcursor(GetAX() - shift * 6, GetAY());
-
- max_o = min(h->GetSize(), offset + nlines * width);
-
- for (i = start_o = offset, j = 0, l = 0; i < max_o; i++) {
- if ((j % width) == 0) {
- mogltk::FixedFont->printf("%08X ", i + virtual_base);
- }
- mogltk::FixedFont->printf("%02X ", data[j]);
- j++;
- if ((j % width) == 0) {
- for (k = start_o, c = 0; k < start_o + width; k++, c++) {
- mogltk::FixedFont->putcursor(GetAX() + (c + width * 3 + 14 - shift) * 6, GetAY() + l * 13);
- if (data[j - width + c] >= 0x20)
- mogltk::FixedFont->putentry(data[j - width + c] - 0x20);
- }
- l++;
- mogltk::FixedFont->putcursor(GetAX() - shift * 6, GetAY() + l * 13);
- start_o = i;
- }
- }
- }
- private:
- Handle * h;
- int width, offset, nlines;
- int offset_loaded, size_loaded, virtual_base;
- int shift;
- Uint8 * data;
-};
-
-class frame : public mogltk::widget {
- public:
- frame(mogltk::shape * sh, mogltk::widget * father) :
- widget(father, 2, 2, father->GetW() - 4, father->GetH() - 4, 0, "MyFrame", sh) { }
- protected:
- virtual void draw() {
- }
- virtual bool process_event(int mx, int my, mogltk::event_t event) {
- mx -= GetAX();
- my -= GetAY();
- return false;
- }
-};
-
-class timer : public mogltk::widget {
- public:
- timer() :
- widget(Application->Root, 0, 0, 0, 0, 0, "Timer", 0), tick(0)
- { set_timed_event(100); }
- protected:
- virtual bool process_event(int, int, mogltk::event_t event) {
- if (event == mogltk::E_TIMER) {
- set_timed_event(100);
- tick = (tick + 1) % 4;
- switch (tick) {
- case 0:
- Application->MainMenu->SetCaption(0, "/");
- break;
- case 1:
- Application->MainMenu->SetCaption(0, "-");
- break;
- case 2:
- Application->MainMenu->SetCaption(0, "\\");
- break;
- case 3:
- Application->MainMenu->SetCaption(0, "I");
- break;
- }
- Application->MainMenu->SetCaption(3, String("FPS: ") + mogltk::engine::FPS());
- return true;
- }
- return false;
- }
- private:
- int tick;
-};
-
-class quit : public mogltk::widgets::action {
- public:
- virtual void do_action(mogltk::widget * w) {
- mogltk::engine::quit();
- }
-} action_quit;
-
-class about : public mogltk::widgets::action {
- public:
- virtual void do_action(mogltk::widget * w) {
- new mogltk::widgets::MsgBox(w->Shaper(), w->Father(), "About...",
- "Dalos version 0.1 - OpenGL version\n"
- "Copyright (C) 2004 Nicolas \"Pixel\" Noble\n"
- "\n"
- "Thanks and greetings fly to (no particular order)\n"
- "GreatSkaori, Orphis, Ti Dragon, Yaz0r, S-O-R,\n"
- "Meradrin, SkeuD, Moogle, InVerse, LavosSpawn\n"
- "\n"
- "And to all I forgot!\n"
- );
- }
-} about_dialog;
-
-virtual int startup() throw (GeneralException) {
- verbosity = M_INFO;
- try {
- new Archive(argv[0], ARCHIVE_EXECUTABLE);
- }
- catch (...) {
- new Archive("Dalos.paq");
- }
-
- mogltk::widgets::ContextMenu * c;
- mogltk::base * gl = new mogltk::glbase();
- mogltk::shape * sh = new mogltk::glshape();
-
- key_vect_mutex = SDL_CreateMutex();
- key_vect_size = SDL_CreateSemaphore(0);
-
- SDL_EnableKeyRepeat(250, 40);
-
- mogltk::engine::setcursorvisible(true);
- mogltk::engine::setappactive(true);
-
- Root = new mogltk::widgets::Root(sh);
- MainMenu = new mogltk::widgets::Menu(sh, Root);
- Frame = new frame(sh, new mogltk::widgets::Frame(sh, Root, 0, MainMenu->GetH(), Root->GetW() - 1, Root->GetH() - MainMenu->GetH() - 1));
-
- (new hexview(sh, Frame))->bind_handle(new Input(argv[0]));
-
- Console = new console(sh, Frame, 0, 8);
- Console->move(0, Frame->GetH() - Console->GetH());
- Console->add_line("Dalos v0.1 - LUA console");
-
- printer = new myprinter();
- locker = new threaded_locker();
-
- start_lua();
-
- SDL_CreateThread(readline_thread, 0);
- MainMenu->addnode("/", 0);
-
- c = MainMenu->createsub("File");
- c->addnode("Quit", &action_quit);
-
- c = MainMenu->createsub("Help");
- c->addnode("About", &about_dialog);
-
- MainMenu->addnode("FPS:", 0);
-
- new timer();
-
- // Setting up the key event handlers
- new hexview_keyevent;
- new console_keyevent; // Should be one of the last
-
- // And launching the main loop
- Root->mainloop();
-
- // Should cleanup here...
-
- return 0;
-}
-
-CODE_ENDS
+/*
+ * Dalos
+ * Copyright (C) 2004 Nicolas "Pixel" Noble
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* $Id: Dalos.cc,v 1.7 2004-10-19 01:27:27 pixel Exp $ */
+
+#include <SDL.h>
+#include <SDL_thread.h>
+
+#include <vector>
+
+#include <Main.h>
+#include <Handle.h>
+#include <Input.h>
+#include <Buffer.h>
+#include <BLua.h>
+#include <LuaHandle.h>
+
+#include <engine.h>
+#include <glbase.h>
+#include <glshape.h>
+#include <font.h>
+
+#include <luacd.h>
+#include <luapsx.h>
+
+#include <Console.h>
+
+#include "cd-tool-hc.h"
+
+#ifdef __MINGW32__
+#define main SDL_main
+#endif
+
+bool auto_exec = true;
+bool lua_started = false;
+bool do_lua_break = false;
+
+CODE_BEGINS
+
+class hexview;
+
+hexview * hexviewer;
+
+mogltk::widgets::Root * Root;
+mogltk::widget * Frame, * MainPanel;
+mogltk::widgets::Menu * MainMenu;
+
+class threaded_Lua : public Lua {
+ public:
+ threaded_Lua() : mutex(SDL_CreateMutex()) { }
+ virtual ~threaded_Lua() { SDL_DestroyMutex(mutex); }
+ virtual void lock() {
+ SDL_mutexP(mutex);
+ }
+ virtual void unlock() {
+ SDL_mutexV(mutex);
+ }
+ private:
+ SDL_mutex * mutex;
+};
+
+class threaded_locker : public locker_t {
+ public:
+ threaded_locker() : mutex(SDL_CreateMutex()) { }
+ virtual ~threaded_locker() { SDL_DestroyMutex(mutex); }
+ virtual void lock() {
+ SDL_mutexP(mutex);
+ }
+ virtual void unlock() {
+ SDL_mutexV(mutex);
+ }
+ private:
+ SDL_mutex * mutex;
+};
+
+static int lua_print(lua_State * _L) {
+ Lua * L = Lua::find(_L);
+ String t = L->tostring() + "\n";
+ char * tc = t.strdup();
+
+ printm(M_STATUS, "%s", tc);
+
+ free(tc);
+
+ return 0;
+}
+
+static void lua_hook(lua_State * _L, lua_Debug * ar) {
+ if (!lua_started)
+ return;
+ Lua * L = Lua::find(_L);
+
+ if (do_lua_break) {
+ L->do_break();
+ do_lua_break = false;
+ }
+}
+
+void start_lua() {
+ Lua * L = new threaded_Lua();
+ Buffer built;
+ bool use_builtin_cdtool = false;
+ int i;
+
+ L->open_base();
+ L->open_math();
+ L->open_string();
+ L->open_table();
+
+ LuaInput::pushconstruct(L);
+ LuaOutput::pushconstruct(L);
+ LuaBuffer::pushconstruct(L);
+
+ CD_PUSHSTATICS(L);
+ Luapsx::pushstatics(L);
+
+ L->push("print");
+ L->push(lua_print);
+ L->setvar();
+
+ L->sethook(lua_hook, LUA_MASKLINE, 0);
+
+ console_lock = SDL_CreateMutex();
+ console_sem = SDL_CreateSemaphore(0);
+
+ try {
+ L->load(&Input("cd-tool.lua"));
+ } catch (GeneralException e) {
+ printm(M_WARNING, "There was an error loading cd-tool.lua: %s, using built-in.\n", e.GetMsg());
+ use_builtin_cdtool = true;
+ }
+
+ if (use_builtin_cdtool) {
+ for (i = 0; i < cd_tool_lua_size; i++) {
+ built.writeU8(cd_tool_lua[i]);
+ }
+ try {
+ L->load(&built);
+ }
+ catch (GeneralException e) {
+ printm(M_WARNING, "There was an error loading built-in cd-tool.lua: %s\n", e.GetMsg());
+ }
+ }
+
+ SDL_CreateThread(LuaThread, L);
+}
+
+static int LuaThread(void * d) {
+ Lua * L = (Lua *) d;
+ while (true) {
+ SDL_SemWait(console_sem);
+ lua_started = true;
+ SDL_mutexP(console_lock);
+ try {
+ L->load(&console_buffer);
+ }
+ catch (LuaException e) {
+ /* If there was an error, ignore it, and free the stack */
+ while(L->gettop())
+ L->pop();
+ }
+ catch (GeneralException e) {
+ /* A more severe exception... */
+ while(L->gettop())
+ L->pop();
+ printm(M_ERROR, "Aborted. LUA caused the following exception: %s\n", e.GetMsg());
+ }
+ SDL_mutexV(console_lock);
+ lua_started = false;
+ }
+}
+
+class hexview_keyevent : public mogltk::engine::keyevent {
+ public:
+ virtual void down(SDL_keysym k) {
+ if (!Application->hexviewer || !Application->hexviewer->GetVisible()) {
+ if (old_handler)
+ old_handler->down(k);
+ return;
+ }
+ switch (k.sym) {
+ case SDLK_DOWN:
+ Application->hexviewer->change_offset(Application->hexviewer->get_offset() + Application->hexviewer->get_width());
+ break;
+ case SDLK_UP:
+ Application->hexviewer->change_offset(Application->hexviewer->get_offset() - Application->hexviewer->get_width());
+ break;
+ case SDLK_RIGHT:
+ if (KMOD_ALT & k.mod) {
+ Application->hexviewer->change_width(Application->hexviewer->get_width() + 1);
+ } else if (KMOD_CTRL & k.mod) {
+ Application->hexviewer->change_shift(Application->hexviewer->get_shift() - 1);
+ } else {
+ Application->hexviewer->change_offset(Application->hexviewer->get_offset() + 1);
+ }
+ break;
+ case SDLK_LEFT:
+ if (KMOD_ALT & k.mod) {
+ Application->hexviewer->change_width(Application->hexviewer->get_width() - 1);
+ } else if (KMOD_CTRL & k.mod) {
+ Application->hexviewer->change_shift(Application->hexviewer->get_shift() + 1);
+ } else {
+ Application->hexviewer->change_offset(Application->hexviewer->get_offset() - 1);
+ }
+ break;
+ case SDLK_PAGEDOWN:
+ Application->hexviewer->change_offset(Application->hexviewer->get_offset() + Application->hexviewer->get_width() * Application->hexviewer->get_nlines());
+ break;
+ case SDLK_PAGEUP:
+ Application->hexviewer->change_offset(Application->hexviewer->get_offset() - Application->hexviewer->get_width() * Application->hexviewer->get_nlines());
+ break;
+ case SDLK_HOME:
+ Application->hexviewer->change_offset(0);
+ break;
+ case SDLK_END:
+ Application->hexviewer->change_offset(Application->hexviewer->get_size() - 1);
+ break;
+ default:
+ if (old_handler)
+ old_handler->down(k);
+ return;
+ }
+ }
+ virtual void up(SDL_keysym k) {
+ if (old_handler)
+ old_handler->up(k);
+ }
+};
+
+class myprinter : public printer_t {
+ public:
+ myprinter() : lock(SDL_CreateMutex()) { }
+ virtual ~myprinter() { SDL_DestroyMutex(lock); }
+ virtual bool printm(int level, const char * m, va_list ap) {
+ static String heads[] = {"EE", "--", "WW", "II"};
+ static char buffer[20480];
+
+ if (level >= M_INFO)
+ return true;
+
+ SDL_mutexP(lock);
+
+ vsprintf(buffer, m, ap);
+ if (level >= 0)
+ CurrentConsole->add_line("(" + heads[level] + ") " + buffer);
+ else
+ CurrentConsole->add_line(buffer);
+
+ SDL_mutexV(lock);
+
+ return true;
+ }
+ private:
+ SDL_mutex * lock;
+};
+
+class hexview : public mogltk::widget {
+ public:
+ hexview(mogltk::shape * sh, mogltk::widget * father) :
+ widget(father, 0, 0, father->GetW(), father->GetH(), 0, "hexview", sh), h(0), width(16), offset(0), offset_loaded(-1), size_loaded(0), data(0), virtual_base(0), shift(0)
+ { nlines = GetH() / 13; Application->hexviewer = this; }
+ virtual ~hexview() { free(data); Application->hexviewer = 0; }
+ void set_virtual_base(int _virtual_base) {
+ virtual_base = _virtual_base;
+ }
+ int get_nlines() {
+ return nlines;
+ }
+ int get_size() {
+ if (!h)
+ return 0;
+ return h->GetSize();
+ }
+ void change_width(int _width) {
+ if (_width <= 0)
+ _width = 1;
+ if (width != _width) {
+ free(data);
+ width = _width;
+ }
+ }
+ int get_width() {
+ return width;
+ }
+ void change_offset(int _offset) {
+ if ((_offset < 0) || !h)
+ _offset = 0;
+ if (h && (_offset >= h->GetSize()))
+ _offset = h->GetSize() - 1;
+ offset = _offset;
+ }
+ int get_offset() {
+ return offset;
+ }
+ void change_shift(int _shift) {
+ if (_shift < 0)
+ _shift = 0;
+ shift = _shift;
+ }
+ int get_shift() {
+ return shift;
+ }
+ void bind_handle(Handle * _h) {
+ h = _h;
+ }
+ Uint8 * get_data() {
+ if (!data) {
+ data = (Uint8 *) malloc(nlines * width);
+ }
+
+ if ((offset_loaded == offset) && (size_loaded == (nlines * width)))
+ return data;
+
+ h->seek(offset);
+ h->read(data, nlines * width);
+
+ offset_loaded = offset;
+ size_loaded = nlines * width;
+
+ return data;
+ }
+ virtual void draw() {
+ int i, max_o, j, k, start_o, l, c;
+
+ if (!h)
+ return;
+
+ get_data();
+
+ mogltk::FixedFont->setcolor(WHITE);
+ mogltk::FixedFont->putcursor(GetAX() - shift * 6, GetAY());
+
+ max_o = min(h->GetSize(), offset + nlines * width);
+
+ for (i = start_o = offset, j = 0, l = 0; i < max_o; i++) {
+ if ((j % width) == 0) {
+ mogltk::FixedFont->printf("%08X ", i + virtual_base);
+ }
+ mogltk::FixedFont->printf("%02X ", data[j]);
+ j++;
+ if ((j % width) == 0) {
+ for (k = start_o, c = 0; k < start_o + width; k++, c++) {
+ mogltk::FixedFont->putcursor(GetAX() + (c + width * 3 + 14 - shift) * 6, GetAY() + l * 13);
+ if (data[j - width + c] >= 0x20)
+ // Have better font support here...
+ mogltk::FixedFont->putentry(data[j - width + c] - 0x20);
+ }
+ l++;
+ mogltk::FixedFont->putcursor(GetAX() - shift * 6, GetAY() + l * 13);
+ start_o = i;
+ }
+ }
+ }
+ protected:
+ virtual void resize_notify() {
+ nlines = Father()->GetH() / 13;
+ resize(Father()->GetW(), Father()->GetH());
+ }
+ private:
+ Handle * h;
+ int width, offset, nlines;
+ int offset_loaded, size_loaded, virtual_base;
+ int shift;
+ Uint8 * data;
+};
+
+class frame : public mogltk::widget {
+ public:
+ frame(mogltk::shape * sh, mogltk::widget * father) :
+ widget(father, 2, 2, father->GetW() - 4, father->GetH() - 4, 0, "MyFrame", sh) { }
+ protected:
+ virtual void draw() {
+ }
+ virtual mogltk::rect GetDrawRect() {
+ mogltk::rect r;
+
+ r.x = GetX() + 2;
+ r.y = GetY() + 2;
+ r.w = GetW() - 4;
+ r.h = GetH() - 4;
+
+ return r;
+ }
+ virtual bool process_event(int mx, int my, mogltk::event_t event) {
+ mx -= GetAX();
+ my -= GetAY();
+ return false;
+ }
+ virtual void resize_notify() {
+ resize(Father()->GetW() - 4, Father()->GetH() - 4);
+ }
+};
+
+class timer : public mogltk::widget {
+ public:
+ timer() :
+ widget(Application->Root, 0, 0, 0, 0, 0, "Timer", 0), tick(0)
+ { set_timed_event(100); }
+ protected:
+ virtual bool process_event(int, int, mogltk::event_t event) {
+ if (event == mogltk::E_TIMER) {
+ set_timed_event(100);
+ tick = (tick + 1) % 4;
+ switch (tick) {
+ case 0:
+ Application->MainMenu->SetCaption(0, "/");
+ break;
+ case 1:
+ Application->MainMenu->SetCaption(0, "-");
+ break;
+ case 2:
+ Application->MainMenu->SetCaption(0, "\\");
+ break;
+ case 3:
+ Application->MainMenu->SetCaption(0, "I");
+ break;
+ }
+ Application->MainMenu->SetCaption(3, String("FPS: ") + mogltk::engine::FPS());
+ return true;
+ }
+ return false;
+ }
+ private:
+ int tick;
+};
+
+class quit : public mogltk::widgets::action {
+ public:
+ virtual void do_action(mogltk::widget * w) {
+ mogltk::engine::quit();
+ }
+} action_quit;
+
+class about : public mogltk::widgets::action {
+ public:
+ virtual void do_action(mogltk::widget * w) {
+ new mogltk::widgets::MsgBox(w->Shaper(), w->Father(), "About...",
+ "Dalos version 0.1 - OpenGL version\n"
+ "Copyright (C) 2004 Nicolas \"Pixel\" Noble\n"
+ "\n"
+ "Thanks and greetings fly to (no particular order)\n"
+ "GreatSkaori, Orphis, Ti Dragon, Yaz0r, S-O-R,\n"
+ "Meradrin, SkeuD, Moogle, InVerse, LavosSpawn\n"
+ "\n"
+ "And to all I forgot!\n"
+ );
+ }
+} about_dialog;
+
+virtual int startup() throw (GeneralException) {
+ verbosity = M_INFO;
+ try {
+ new Archive(argv[0], ARCHIVE_EXECUTABLE);
+ }
+ catch (...) {
+ new Archive("Dalos.paq");
+ }
+
+ mogltk::widgets::ContextMenu * c;
+ mogltk::base * gl = new mogltk::glbase();
+ mogltk::shape * sh = new mogltk::glshape();
+
+ SDL_EnableKeyRepeat(250, 40);
+
+ mogltk::engine::setcursorvisible(true);
+ mogltk::engine::setappactive(true);
+
+ Root = new mogltk::widgets::Root(sh);
+ MainPanel = Root->InnerPanel();
+ MainMenu = new mogltk::widgets::Menu(sh, MainPanel);
+ Frame = new frame(sh, new mogltk::widgets::Frame(sh, MainPanel, 0, MainMenu->GetH(), Root->GetW() - 1, Root->GetH() - MainMenu->GetH() - 1));
+
+ mogltk::widget * box = new mogltk::widgets::SmartBox(sh, MainPanel, 50, 50, 500, 400, "Hexview");
+ (new hexview(sh, box->InnerPanel()))->bind_handle(new Input(argv[0]));
+
+ CurrentConsole = new console(sh, Root, 0, 8);
+ CurrentConsole->move(0, Root->GetH() - CurrentConsole->GetH());
+ CurrentConsole->add_line("Dalos v0.1 - LUA console");
+
+ printer = new myprinter();
+ locker = new threaded_locker();
+
+ start_lua();
+
+ // Filling menu.
+ MainMenu->addnode("/", 0);
+
+ c = MainMenu->createsub("File");
+ c->addnode("Quit", &action_quit);
+
+ c = MainMenu->createsub("Help");
+ c->addnode("About", &about_dialog);
+
+ MainMenu->addnode("FPS:", 0);
+
+ new timer();
+
+ // Setting up the key event handlers
+ new hexview_keyevent;
+ new console_keyevent; // Should be one of the last
+
+ // And launching the main loop
+ Root->mainloop();
+
+ // Should cleanup here... nevermind ;)
+
+ return 0;
+}
+
+CODE_ENDS
diff --git a/MSVC/Baltisot - generic/Baltisot - generic.vcproj b/MSVC/Baltisot - generic/Baltisot - generic.vcproj
index c2d12cc..8188d3b 100644
--- a/MSVC/Baltisot - generic/Baltisot - generic.vcproj
+++ b/MSVC/Baltisot - generic/Baltisot - generic.vcproj
@@ -1,684 +1,698 @@
-<?xml version="1.0" encoding = "Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.00"
- Name="Baltisot - generic"
- ProjectGUID="{879D8D90-9A7E-4F3C-9B4E-F1648C8AE927}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="Debug"
- IntermediateDirectory="Debug"
- ConfigurationType="4"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\..\generic\include;..\..\generic\lib\zlib\include;..\..\generic\lib\lua\includes;..\..\generic\lib\lua\include"
- PreprocessorDefinitions="_WINDOWS;ZLIB_DLL;READLINE_STATIC;READLINE_LIBRARY"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="5"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)/Baltisot - generic.lib"
- IgnoreAllDefaultLibraries="FALSE"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
- ConfigurationType="4"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- InlineFunctionExpansion="1"
- OmitFramePointers="TRUE"
- AdditionalIncludeDirectories="..\..\generic\include;..\..\generic\lib\zlib\include;..\..\generic\lib\lua\includes;..\..\generic\lib\lua\include"
- PreprocessorDefinitions="_WINDOWS;ZLIB_DLL;NO_HFILE;READLINE_STATIC;READLINE_LIBRARY"
- StringPooling="TRUE"
- RuntimeLibrary="4"
- EnableFunctionLevelLinking="TRUE"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)/Baltisot - generic.lib"
- IgnoreAllDefaultLibraries="FALSE"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- </Configuration>
- </Configurations>
- <Files>
- <Filter
- Name="Base class"
- Filter="">
- <File
- RelativePath="..\..\generic\lib\Exceptions.cc">
- </File>
- <File
- RelativePath="..\..\generic\include\Exceptions.h">
- </File>
- <File
- RelativePath="..\..\generic\lib\generic.cc">
- </File>
- <File
- RelativePath="..\..\generic\include\generic.h">
- </File>
- </Filter>
- <Filter
- Name="String class"
- Filter="">
- <File
- RelativePath="..\..\generic\include\BString.h">
- </File>
- <File
- RelativePath="..\..\generic\lib\String.cc">
- </File>
- <File
- RelativePath="..\..\generic\lib\checkargs.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\datecalc.c">
- </File>
- </Filter>
- <Filter
- Name="Handle class"
- Filter="">
- <File
- RelativePath="..\..\generic\lib\Handle.cc">
- </File>
- <File
- RelativePath="..\..\generic\include\Handle.h">
- </File>
- <Filter
- Name="Input class"
- Filter="">
- <File
- RelativePath="..\..\generic\lib\Input.cc">
- </File>
- <File
- RelativePath="..\..\generic\include\Input.h">
- </File>
- </Filter>
- <Filter
- Name="Output class"
- Filter="">
- <File
- RelativePath="..\..\generic\lib\Output.cc">
- </File>
- <File
- RelativePath="..\..\generic\include\Output.h">
- </File>
- </Filter>
- <Filter
- Name="Buffer class"
- Filter="">
- <File
- RelativePath="..\..\generic\lib\Buffer.cc">
- </File>
- <File
- RelativePath="..\..\generic\include\Buffer.h">
- </File>
- </Filter>
- </Filter>
- <Filter
- Name="BLua class"
- Filter="">
- <File
- RelativePath="..\..\generic\lib\BLua.cc">
- </File>
- <File
- RelativePath="..\..\generic\include\BLua.h">
- </File>
- <Filter
- Name="LuaHandle"
- Filter="">
- <File
- RelativePath="..\..\generic\lib\LuaHandle.cc">
- </File>
- <File
- RelativePath="..\..\generic\include\LuaHandle.h">
- </File>
- </Filter>
- </Filter>
- <Filter
- Name="Main class"
- Filter="">
- <File
- RelativePath="..\..\generic\lib\Main.cc">
- </File>
- <File
- RelativePath="..\..\generic\include\Main.h">
- </File>
- </Filter>
- <Filter
- Name="Documentation"
- Filter="">
- <File
- RelativePath="..\..\generic\doc\API">
- </File>
- <File
- RelativePath="..\..\generic\doc\README">
- </File>
- <File
- RelativePath="..\..\generic\doc\rfc1866.txt">
- </File>
- <File
- RelativePath="..\..\generic\doc\rfc2616.txt">
- </File>
- <File
- RelativePath="..\..\generic\doc\rfc2812.txt">
- </File>
- <File
- RelativePath="..\..\generic\doc\rfc959.txt">
- </File>
- </Filter>
- <Filter
- Name="Lua (external)"
- Filter="">
- <File
- RelativePath="..\..\generic\lib\lua\src\luacomp.c">
- </File>
- <Filter
- Name="LuaSrc"
- Filter="">
- <File
- RelativePath="..\..\generic\lib\lua\src\lapi.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\src\lcode.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\src\ldebug.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\src\ldo.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\src\ldump.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\src\lfunc.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\src\lgc.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\src\llex.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\src\lmem.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\src\lobject.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\src\lopcodes.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\src\lparser.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\src\lstate.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\src\lstring.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\src\ltable.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\src\ltests.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\src\ltm.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\src\lundump.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\src\lvm.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\src\lzio.c">
- </File>
- </Filter>
- <Filter
- Name="LuaIncludes"
- Filter="">
- <File
- RelativePath="..\..\generic\lib\lua\include\lauxlib.h">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\include\lua.h">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\include\lualib.h">
- </File>
- </Filter>
- <Filter
- Name="LuaLib"
- Filter="">
- <File
- RelativePath="..\..\generic\lib\lua\src\LuaLib\lauxlib.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\src\LuaLib\lbaselib.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\src\LuaLib\ldblib.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\src\LuaLib\liolib.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\src\LuaLib\lmathlib.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\src\LuaLib\loadlib.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\src\LuaLib\lstrlib.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\src\LuaLib\ltablib.c">
- </File>
- </Filter>
- <Filter
- Name="LuaHeaders"
- Filter="">
- <File
- RelativePath="..\..\generic\lib\lua\includes\lapi.h">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\includes\lcode.h">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\includes\ldebug.h">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\includes\ldo.h">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\includes\lfunc.h">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\includes\lgc.h">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\includes\llex.h">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\includes\llimits.h">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\includes\lmem.h">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\includes\lobject.h">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\includes\lopcodes.h">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\includes\lparser.h">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\includes\lstate.h">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\includes\lstring.h">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\includes\ltable.h">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\includes\ltm.h">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\includes\lundump.h">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\includes\lvm.h">
- </File>
- <File
- RelativePath="..\..\generic\lib\lua\includes\lzio.h">
- </File>
- </Filter>
- </Filter>
- <Filter
- Name="GetOpt (external)"
- Filter="">
- <File
- RelativePath="..\getopt\getopt.c">
- </File>
- <File
- RelativePath="..\getopt\getopt.h">
- </File>
- <File
- RelativePath="..\getopt\getopt1.c">
- </File>
- </Filter>
- <Filter
- Name="Zlib (external)"
- Filter="">
- <Filter
- Name="Src"
- Filter="">
- <File
- RelativePath="..\..\generic\lib\zlib\src\adler32.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\zlib\src\compress.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\zlib\src\crc32.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\zlib\src\deflate.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\zlib\src\gzio.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\zlib\src\infblock.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\zlib\src\infcodes.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\zlib\src\inffast.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\zlib\src\inflate.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\zlib\src\inftrees.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\zlib\src\infutil.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\zlib\src\trees.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\zlib\src\uncompr.c">
- </File>
- <File
- RelativePath="..\..\generic\lib\zlib\src\zutil.c">
- </File>
- </Filter>
- <Filter
- Name="Includes"
- Filter="">
- <File
- RelativePath="..\..\generic\lib\zlib\include\deflate.h">
- </File>
- <File
- RelativePath="..\..\generic\lib\zlib\include\infblock.h">
- </File>
- <File
- RelativePath="..\..\generic\lib\zlib\include\infcodes.h">
- </File>
- <File
- RelativePath="..\..\generic\lib\zlib\include\inffast.h">
- </File>
- <File
- RelativePath="..\..\generic\lib\zlib\include\inffixed.h">
- </File>
- <File
- RelativePath="..\..\generic\lib\zlib\include\inftrees.h">
- </File>
- <File
- RelativePath="..\..\generic\lib\zlib\include\infutil.h">
- </File>
- <File
- RelativePath="..\..\generic\lib\zlib\include\trees.h">
- </File>
- <File
- RelativePath="..\..\generic\lib\zlib\include\zconf.h">
- </File>
- <File
- RelativePath="..\..\generic\lib\zlib\include\zlib.h">
- </File>
- <File
- RelativePath="..\..\generic\lib\zlib\include\zutil.h">
- </File>
- </Filter>
- </Filter>
- <Filter
- Name="Readline (external)"
- Filter="">
- <File
- RelativePath="..\readline\ansi_stdlib.h">
- </File>
- <File
- RelativePath="..\readline\bind.c">
- </File>
- <File
- RelativePath="..\readline\callback.c">
- </File>
- <File
- RelativePath="..\readline\chardefs.h">
- </File>
- <File
- RelativePath="..\readline\compat.c">
- </File>
- <File
- RelativePath="..\readline\complete.c">
- </File>
- <File
- RelativePath="..\readline\config.h">
- </File>
- <File
- RelativePath="..\readline\dirent.c">
- </File>
- <File
- RelativePath="..\readline\dirent.h">
- </File>
- <File
- RelativePath="..\readline\display.c">
- </File>
- <File
- RelativePath="..\readline\emacs_keymap.c">
- </File>
- <File
- RelativePath="..\readline\funmap.c">
- </File>
- <File
- RelativePath="..\readline\histexpand.c">
- </File>
- <File
- RelativePath="..\readline\histfile.c">
- </File>
- <File
- RelativePath="..\readline\histlib.h">
- </File>
- <File
- RelativePath="..\readline\history.c">
- </File>
- <File
- RelativePath="..\readline\history.h">
- </File>
- <File
- RelativePath="..\readline\histsearch.c">
- </File>
- <File
- RelativePath="..\readline\input.c">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- ObjectFile="$(IntDir)/$(InputName)1.obj"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- ObjectFile="$(IntDir)/$(InputName)1.obj"/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="..\readline\isearch.c">
- </File>
- <File
- RelativePath="..\readline\keymaps.c">
- </File>
- <File
- RelativePath="..\readline\keymaps.h">
- </File>
- <File
- RelativePath="..\readline\kill.c">
- </File>
- <File
- RelativePath="..\readline\macro.c">
- </File>
- <File
- RelativePath="..\readline\mbutil.c">
- </File>
- <File
- RelativePath="..\readline\misc.c">
- </File>
- <File
- RelativePath="..\readline\nls.c">
- </File>
- <File
- RelativePath="..\readline\parens.c">
- </File>
- <File
- RelativePath="..\readline\posixdir.h">
- </File>
- <File
- RelativePath="..\readline\posixjmp.h">
- </File>
- <File
- RelativePath="..\readline\posixstat.h">
- </File>
- <File
- RelativePath="..\readline\readline.c">
- </File>
- <File
- RelativePath="..\readline\readline.h">
- </File>
- <File
- RelativePath="..\readline\rlconf.h">
- </File>
- <File
- RelativePath="..\readline\rldefs.h">
- </File>
- <File
- RelativePath="..\readline\rldynlink.h">
- </File>
- <File
- RelativePath="..\readline\rlmbutil.h">
- </File>
- <File
- RelativePath="..\readline\rlprivate.h">
- </File>
- <File
- RelativePath="..\readline\rlshell.h">
- </File>
- <File
- RelativePath="..\readline\rlstdc.h">
- </File>
- <File
- RelativePath="..\readline\rltty.c">
- </File>
- <File
- RelativePath="..\readline\rltty.h">
- </File>
- <File
- RelativePath="..\readline\rltypedefs.h">
- </File>
- <File
- RelativePath="..\readline\rlwinsize.h">
- </File>
- <File
- RelativePath="..\readline\savestring.c">
- </File>
- <File
- RelativePath="..\readline\search.c">
- </File>
- <File
- RelativePath="..\readline\shell.c">
- </File>
- <File
- RelativePath="..\readline\signals.c">
- </File>
- <File
- RelativePath="..\readline\tcap.h">
- </File>
- <File
- RelativePath="..\readline\terminal.c">
- </File>
- <File
- RelativePath="..\readline\text.c">
- </File>
- <File
- RelativePath="..\readline\tilde.c">
- </File>
- <File
- RelativePath="..\readline\tilde.h">
- </File>
- <File
- RelativePath="..\readline\undo.c">
- </File>
- <File
- RelativePath="..\readline\util.c">
- </File>
- <File
- RelativePath="..\readline\vi_keymap.c">
- </File>
- <File
- RelativePath="..\readline\vi_mode.c">
- </File>
- <File
- RelativePath="..\readline\xmalloc.c">
- </File>
- <File
- RelativePath="..\readline\xmalloc.h">
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="Baltisot - generic"
+ ProjectGUID="{879D8D90-9A7E-4F3C-9B4E-F1648C8AE927}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="4"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\generic\include;..\..\generic\lib\zlib\include;..\..\generic\lib\lua\includes;..\..\generic\lib\lua\include"
+ PreprocessorDefinitions="_WINDOWS;ZLIB_DLL;READLINE_STATIC;READLINE_LIBRARY"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="5"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="$(OutDir)/Baltisot - generic.lib"
+ IgnoreAllDefaultLibraries="FALSE"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="4"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ AdditionalIncludeDirectories="..\..\generic\include;..\..\generic\lib\zlib\include;..\..\generic\lib\lua\includes;..\..\generic\lib\lua\include"
+ PreprocessorDefinitions="_WINDOWS;ZLIB_DLL;NO_HFILE;READLINE_STATIC;READLINE_LIBRARY"
+ StringPooling="TRUE"
+ RuntimeLibrary="4"
+ EnableFunctionLevelLinking="TRUE"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="$(OutDir)/Baltisot - generic.lib"
+ IgnoreAllDefaultLibraries="FALSE"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Base class"
+ Filter="">
+ <File
+ RelativePath="..\..\generic\lib\Exceptions.cc">
+ </File>
+ <File
+ RelativePath="..\..\generic\include\Exceptions.h">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\generic.cc">
+ </File>
+ <File
+ RelativePath="..\..\generic\include\generic.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="String class"
+ Filter="">
+ <File
+ RelativePath="..\..\generic\include\BString.h">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\checkargs.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\datecalc.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\String.cc">
+ </File>
+ </Filter>
+ <Filter
+ Name="Handle class"
+ Filter="">
+ <File
+ RelativePath="..\..\generic\lib\Handle.cc">
+ </File>
+ <File
+ RelativePath="..\..\generic\include\Handle.h">
+ </File>
+ <Filter
+ Name="Input class"
+ Filter="">
+ <File
+ RelativePath="..\..\generic\lib\Input.cc">
+ </File>
+ <File
+ RelativePath="..\..\generic\include\Input.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Output class"
+ Filter="">
+ <File
+ RelativePath="..\..\generic\lib\Output.cc">
+ </File>
+ <File
+ RelativePath="..\..\generic\include\Output.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Buffer class"
+ Filter="">
+ <File
+ RelativePath="..\..\generic\lib\Buffer.cc">
+ </File>
+ <File
+ RelativePath="..\..\generic\include\Buffer.h">
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="BLua class"
+ Filter="">
+ <File
+ RelativePath="..\..\generic\lib\BLua.cc">
+ </File>
+ <File
+ RelativePath="..\..\generic\include\BLua.h">
+ </File>
+ <Filter
+ Name="LuaHandle"
+ Filter="">
+ <File
+ RelativePath="..\..\generic\lib\LuaHandle.cc">
+ </File>
+ <File
+ RelativePath="..\..\generic\include\LuaHandle.h">
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="Main class"
+ Filter="">
+ <File
+ RelativePath="..\..\generic\lib\Main.cc">
+ </File>
+ <File
+ RelativePath="..\..\generic\include\Main.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Documentation"
+ Filter="">
+ <File
+ RelativePath="..\..\generic\doc\API">
+ </File>
+ <File
+ RelativePath="..\..\generic\doc\README">
+ </File>
+ <File
+ RelativePath="..\..\generic\doc\rfc1866.txt">
+ </File>
+ <File
+ RelativePath="..\..\generic\doc\rfc2616.txt">
+ </File>
+ <File
+ RelativePath="..\..\generic\doc\rfc2812.txt">
+ </File>
+ <File
+ RelativePath="..\..\generic\doc\rfc959.txt">
+ </File>
+ </Filter>
+ <Filter
+ Name="Lua (external)"
+ Filter="">
+ <File
+ RelativePath="..\..\generic\lib\lua\src\luacomp.c">
+ </File>
+ <Filter
+ Name="LuaSrc"
+ Filter="">
+ <File
+ RelativePath="..\..\generic\lib\lua\src\lapi.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\src\lcode.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\src\ldebug.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\src\ldo.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\src\ldump.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\src\lfunc.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\src\lgc.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\src\llex.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\src\lmem.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\src\lobject.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\src\lopcodes.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\src\lparser.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\src\lstate.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\src\lstring.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\src\ltable.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\src\ltests.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\src\ltm.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\src\lundump.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\src\lvm.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\src\lzio.c">
+ </File>
+ </Filter>
+ <Filter
+ Name="LuaIncludes"
+ Filter="">
+ <File
+ RelativePath="..\..\generic\lib\lua\include\lauxlib.h">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\include\lua.h">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\include\lualib.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="LuaLib"
+ Filter="">
+ <File
+ RelativePath="..\..\generic\lib\lua\src\LuaLib\lauxlib.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\src\LuaLib\lbaselib.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\src\LuaLib\ldblib.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\src\LuaLib\liolib.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\src\LuaLib\lmathlib.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\src\LuaLib\loadlib.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\src\LuaLib\lstrlib.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\src\LuaLib\ltablib.c">
+ </File>
+ </Filter>
+ <Filter
+ Name="LuaHeaders"
+ Filter="">
+ <File
+ RelativePath="..\..\generic\lib\lua\includes\lapi.h">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\includes\lcode.h">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\includes\ldebug.h">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\includes\ldo.h">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\includes\lfunc.h">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\includes\lgc.h">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\includes\llex.h">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\includes\llimits.h">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\includes\lmem.h">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\includes\lobject.h">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\includes\lopcodes.h">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\includes\lparser.h">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\includes\lstate.h">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\includes\lstring.h">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\includes\ltable.h">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\includes\ltm.h">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\includes\lundump.h">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\includes\lvm.h">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\lua\includes\lzio.h">
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="GetOpt (external)"
+ Filter="">
+ <File
+ RelativePath="..\getopt\getopt.c">
+ </File>
+ <File
+ RelativePath="..\getopt\getopt.h">
+ </File>
+ <File
+ RelativePath="..\getopt\getopt1.c">
+ </File>
+ </Filter>
+ <Filter
+ Name="Zlib (external)"
+ Filter="">
+ <Filter
+ Name="Src"
+ Filter="">
+ <File
+ RelativePath="..\..\generic\lib\zlib\src\adler32.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\zlib\src\compress.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\zlib\src\crc32.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\zlib\src\deflate.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\zlib\src\gzio.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\zlib\src\infblock.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\zlib\src\infcodes.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\zlib\src\inffast.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\zlib\src\inflate.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\zlib\src\inftrees.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\zlib\src\infutil.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\zlib\src\trees.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\zlib\src\uncompr.c">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\zlib\src\zutil.c">
+ </File>
+ </Filter>
+ <Filter
+ Name="Includes"
+ Filter="">
+ <File
+ RelativePath="..\..\generic\lib\zlib\include\deflate.h">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\zlib\include\infblock.h">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\zlib\include\infcodes.h">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\zlib\include\inffast.h">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\zlib\include\inffixed.h">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\zlib\include\inftrees.h">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\zlib\include\infutil.h">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\zlib\include\trees.h">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\zlib\include\zconf.h">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\zlib\include\zlib.h">
+ </File>
+ <File
+ RelativePath="..\..\generic\lib\zlib\include\zutil.h">
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="Readline (external)"
+ Filter="">
+ <File
+ RelativePath="..\readline\ansi_stdlib.h">
+ </File>
+ <File
+ RelativePath="..\readline\bind.c">
+ </File>
+ <File
+ RelativePath="..\readline\callback.c">
+ </File>
+ <File
+ RelativePath="..\readline\chardefs.h">
+ </File>
+ <File
+ RelativePath="..\readline\compat.c">
+ </File>
+ <File
+ RelativePath="..\readline\complete.c">
+ </File>
+ <File
+ RelativePath="..\readline\config.h">
+ </File>
+ <File
+ RelativePath="..\readline\dirent.c">
+ </File>
+ <File
+ RelativePath="..\readline\dirent.h">
+ </File>
+ <File
+ RelativePath="..\readline\display.c">
+ </File>
+ <File
+ RelativePath="..\readline\emacs_keymap.c">
+ </File>
+ <File
+ RelativePath="..\readline\funmap.c">
+ </File>
+ <File
+ RelativePath="..\readline\histexpand.c">
+ </File>
+ <File
+ RelativePath="..\readline\histfile.c">
+ </File>
+ <File
+ RelativePath="..\readline\histlib.h">
+ </File>
+ <File
+ RelativePath="..\readline\history.c">
+ </File>
+ <File
+ RelativePath="..\readline\history.h">
+ </File>
+ <File
+ RelativePath="..\readline\histsearch.c">
+ </File>
+ <File
+ RelativePath="..\readline\input.c">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ ObjectFile="$(IntDir)/$(InputName)1.obj"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\readline\isearch.c">
+ </File>
+ <File
+ RelativePath="..\readline\keymaps.c">
+ </File>
+ <File
+ RelativePath="..\readline\keymaps.h">
+ </File>
+ <File
+ RelativePath="..\readline\kill.c">
+ </File>
+ <File
+ RelativePath="..\readline\macro.c">
+ </File>
+ <File
+ RelativePath="..\readline\mbutil.c">
+ </File>
+ <File
+ RelativePath="..\readline\misc.c">
+ </File>
+ <File
+ RelativePath="..\readline\nls.c">
+ </File>
+ <File
+ RelativePath="..\readline\parens.c">
+ </File>
+ <File
+ RelativePath="..\readline\posixdir.h">
+ </File>
+ <File
+ RelativePath="..\readline\posixjmp.h">
+ </File>
+ <File
+ RelativePath="..\readline\posixstat.h">
+ </File>
+ <File
+ RelativePath="..\readline\readline.c">
+ </File>
+ <File
+ RelativePath="..\readline\readline.h">
+ </File>
+ <File
+ RelativePath="..\readline\rlconf.h">
+ </File>
+ <File
+ RelativePath="..\readline\rldefs.h">
+ </File>
+ <File
+ RelativePath="..\readline\rldynlink.h">
+ </File>
+ <File
+ RelativePath="..\readline\rlmbutil.h">
+ </File>
+ <File
+ RelativePath="..\readline\rlprivate.h">
+ </File>
+ <File
+ RelativePath="..\readline\rlshell.h">
+ </File>
+ <File
+ RelativePath="..\readline\rlstdc.h">
+ </File>
+ <File
+ RelativePath="..\readline\rltty.c">
+ </File>
+ <File
+ RelativePath="..\readline\rltty.h">
+ </File>
+ <File
+ RelativePath="..\readline\rltypedefs.h">
+ </File>
+ <File
+ RelativePath="..\readline\rlwinsize.h">
+ </File>
+ <File
+ RelativePath="..\readline\savestring.c">
+ </File>
+ <File
+ RelativePath="..\readline\search.c">
+ </File>
+ <File
+ RelativePath="..\readline\shell.c">
+ </File>
+ <File
+ RelativePath="..\readline\signals.c">
+ </File>
+ <File
+ RelativePath="..\readline\tcap.h">
+ </File>
+ <File
+ RelativePath="..\readline\terminal.c">
+ </File>
+ <File
+ RelativePath="..\readline\text.c">
+ </File>
+ <File
+ RelativePath="..\readline\tilde.c">
+ </File>
+ <File
+ RelativePath="..\readline\tilde.h">
+ </File>
+ <File
+ RelativePath="..\readline\undo.c">
+ </File>
+ <File
+ RelativePath="..\readline\util.c">
+ </File>
+ <File
+ RelativePath="..\readline\vi_keymap.c">
+ </File>
+ <File
+ RelativePath="..\readline\vi_mode.c">
+ </File>
+ <File
+ RelativePath="..\readline\xmalloc.c">
+ </File>
+ <File
+ RelativePath="..\readline\xmalloc.h">
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/MSVC/Dalos/Dalos.vcproj b/MSVC/Dalos/Dalos.vcproj
index 73dcc7a..ef4f9fa 100644
--- a/MSVC/Dalos/Dalos.vcproj
+++ b/MSVC/Dalos/Dalos.vcproj
@@ -1,116 +1,136 @@
-<?xml version="1.0" encoding = "Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.00"
- Name="Dalos"
- ProjectGUID="{22F8F8CD-B256-446D-9B42-09CE83F74885}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="Debug"
- IntermediateDirectory="Debug"
- ConfigurationType="1"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\..\generic\include;..\..\generic\lib\zlib\include;..\..\generic\lib\lua\include;..\..\mogltk\include;&quot;..\..\..\SDL-1.2.7\include&quot;;..\..\MSVC;..\..;..\..\includes;..\..\psxdev"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;READLINE_LIBRARY;READLINE_STATIC"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="5"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalOptions="/FORCE:MULTIPLE"
- AdditionalDependencies="SDLmain.lib SDL.lib opengl32.lib glu32.lib"
- OutputFile="$(OutDir)/Dalos.exe"
- LinkIncremental="2"
- AdditionalLibraryDirectories="&quot;..\..\..\SDL-1.2.7\lib&quot;"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/Dalos.pdb"
- SubSystem="1"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
- ConfigurationType="1"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- InlineFunctionExpansion="1"
- OmitFramePointers="TRUE"
- AdditionalIncludeDirectories="..\..\generic\include;..\..\generic\lib\zlib\include;..\..\generic\lib\lua\include;..\..\mogltk\include;&quot;..\..\..\SDL-1.2.7\include&quot;;..\..\MSVC;..\..\;..\..\includes;..\..\psxdev"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;READLINE_LIBRARY;READLINE_STATIC"
- StringPooling="TRUE"
- RuntimeLibrary="4"
- EnableFunctionLevelLinking="TRUE"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalOptions="/FORCE:MULTIPLE"
- AdditionalDependencies="SDLmain.lib SDL.lib opengl32.lib glu32.lib"
- OutputFile="$(OutDir)/Dalos.exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories="&quot;..\..\..\SDL-1.2.7\lib&quot;"
- GenerateDebugInformation="TRUE"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- </Configuration>
- </Configurations>
- <Files>
- <File
- RelativePath="..\..\Dalos\Dalos.cc">
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="Dalos"
+ ProjectGUID="{22F8F8CD-B256-446D-9B42-09CE83F74885}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\generic\include;..\..\generic\lib\zlib\include;..\..\generic\lib\lua\include;..\..\mogltk\include;&quot;..\..\..\SDL-1.2.7\include&quot;;..\..\MSVC;..\..;..\..\includes;..\..\psxdev;..\..\Dalos"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;READLINE_LIBRARY;READLINE_STATIC"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="5"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/FORCE:MULTIPLE"
+ AdditionalDependencies="SDLmain.lib SDL.lib opengl32.lib glu32.lib"
+ OutputFile="$(OutDir)/Dalos.exe"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="&quot;..\..\..\SDL-1.2.7\lib&quot;"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)/Dalos.pdb"
+ SubSystem="1"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ AdditionalIncludeDirectories="..\..\generic\include;..\..\generic\lib\zlib\include;..\..\generic\lib\lua\include;..\..\mogltk\include;&quot;..\..\..\SDL-1.2.7\include&quot;;..\..\MSVC;..\..\;..\..\includes;..\..\psxdev;..\..\Dalos"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;READLINE_LIBRARY;READLINE_STATIC"
+ StringPooling="TRUE"
+ RuntimeLibrary="4"
+ EnableFunctionLevelLinking="TRUE"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/FORCE:MULTIPLE"
+ AdditionalDependencies="SDLmain.lib SDL.lib opengl32.lib glu32.lib"
+ OutputFile="$(OutDir)/Dalos.exe"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="&quot;..\..\..\SDL-1.2.7\lib&quot;"
+ GenerateDebugInformation="TRUE"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath="..\..\Dalos\Console.cc">
+ </File>
+ <File
+ RelativePath="..\..\Dalos\Console.h">
+ </File>
+ <File
+ RelativePath="..\..\Dalos\Dalos.cc">
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/MSVC/PSX-Bundle - library/PSX-Bundle - library.vcproj b/MSVC/PSX-Bundle - library/PSX-Bundle - library.vcproj
index b3e4296..bae4ecf 100644
--- a/MSVC/PSX-Bundle - library/PSX-Bundle - library.vcproj
+++ b/MSVC/PSX-Bundle - library/PSX-Bundle - library.vcproj
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding = "Windows-1252"?>
+<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="7.00"
+ Version="7.10"
Name="PSX-Bundle - library"
ProjectGUID="{0A2CD193-F270-4F2B-943C-F8BDF792D25C}"
Keyword="Win32Proj">
@@ -45,6 +45,12 @@
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
@@ -83,8 +89,16 @@
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
+ <References>
+ </References>
<Files>
<Filter
Name="Lzss class"
diff --git a/MSVC/PSX-Bundle.sln b/MSVC/PSX-Bundle.sln
index 343d977..7c5a38d 100644
--- a/MSVC/PSX-Bundle.sln
+++ b/MSVC/PSX-Bundle.sln
@@ -1,52 +1,60 @@
-Microsoft Visual Studio Solution File, Format Version 7.00
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tools", "Tools\Tools.vcproj", "{6CAE7F4D-C27B-43F3-B30A-84C5F32EFA29}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mogltk", "mogltk\mogltk.vcproj", "{34BCDA3E-D3E2-4A8D-BF73-7D770EE6966A}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Dalos", "Dalos\Dalos.vcproj", "{22F8F8CD-B256-446D-9B42-09CE83F74885}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Baltisot - generic", "Baltisot - generic\Baltisot - generic.vcproj", "{879D8D90-9A7E-4F3C-9B4E-F1648C8AE927}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PSX-Bundle - library", "PSX-Bundle - library\PSX-Bundle - library.vcproj", "{0A2CD193-F270-4F2B-943C-F8BDF792D25C}"
-EndProject
-Global
- GlobalSection(SolutionConfiguration) = preSolution
- ConfigName.0 = Debug
- ConfigName.1 = Release
- EndGlobalSection
- GlobalSection(ProjectDependencies) = postSolution
- {6CAE7F4D-C27B-43F3-B30A-84C5F32EFA29}.0 = {879D8D90-9A7E-4F3C-9B4E-F1648C8AE927}
- {6CAE7F4D-C27B-43F3-B30A-84C5F32EFA29}.1 = {0A2CD193-F270-4F2B-943C-F8BDF792D25C}
- {34BCDA3E-D3E2-4A8D-BF73-7D770EE6966A}.0 = {879D8D90-9A7E-4F3C-9B4E-F1648C8AE927}
- {22F8F8CD-B256-446D-9B42-09CE83F74885}.0 = {34BCDA3E-D3E2-4A8D-BF73-7D770EE6966A}
- {22F8F8CD-B256-446D-9B42-09CE83F74885}.1 = {879D8D90-9A7E-4F3C-9B4E-F1648C8AE927}
- {22F8F8CD-B256-446D-9B42-09CE83F74885}.2 = {0A2CD193-F270-4F2B-943C-F8BDF792D25C}
- {0A2CD193-F270-4F2B-943C-F8BDF792D25C}.0 = {879D8D90-9A7E-4F3C-9B4E-F1648C8AE927}
- EndGlobalSection
- GlobalSection(ProjectConfiguration) = postSolution
- {6CAE7F4D-C27B-43F3-B30A-84C5F32EFA29}.Debug.ActiveCfg = Debug|Win32
- {6CAE7F4D-C27B-43F3-B30A-84C5F32EFA29}.Debug.Build.0 = Debug|Win32
- {6CAE7F4D-C27B-43F3-B30A-84C5F32EFA29}.Release.ActiveCfg = Release|Win32
- {6CAE7F4D-C27B-43F3-B30A-84C5F32EFA29}.Release.Build.0 = Release|Win32
- {34BCDA3E-D3E2-4A8D-BF73-7D770EE6966A}.Debug.ActiveCfg = Debug|Win32
- {34BCDA3E-D3E2-4A8D-BF73-7D770EE6966A}.Debug.Build.0 = Debug|Win32
- {34BCDA3E-D3E2-4A8D-BF73-7D770EE6966A}.Release.ActiveCfg = Release|Win32
- {34BCDA3E-D3E2-4A8D-BF73-7D770EE6966A}.Release.Build.0 = Release|Win32
- {22F8F8CD-B256-446D-9B42-09CE83F74885}.Debug.ActiveCfg = Debug|Win32
- {22F8F8CD-B256-446D-9B42-09CE83F74885}.Debug.Build.0 = Debug|Win32
- {22F8F8CD-B256-446D-9B42-09CE83F74885}.Release.ActiveCfg = Release|Win32
- {22F8F8CD-B256-446D-9B42-09CE83F74885}.Release.Build.0 = Release|Win32
- {879D8D90-9A7E-4F3C-9B4E-F1648C8AE927}.Debug.ActiveCfg = Debug|Win32
- {879D8D90-9A7E-4F3C-9B4E-F1648C8AE927}.Debug.Build.0 = Debug|Win32
- {879D8D90-9A7E-4F3C-9B4E-F1648C8AE927}.Release.ActiveCfg = Release|Win32
- {879D8D90-9A7E-4F3C-9B4E-F1648C8AE927}.Release.Build.0 = Release|Win32
- {0A2CD193-F270-4F2B-943C-F8BDF792D25C}.Debug.ActiveCfg = Debug|Win32
- {0A2CD193-F270-4F2B-943C-F8BDF792D25C}.Debug.Build.0 = Debug|Win32
- {0A2CD193-F270-4F2B-943C-F8BDF792D25C}.Release.ActiveCfg = Release|Win32
- {0A2CD193-F270-4F2B-943C-F8BDF792D25C}.Release.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- EndGlobalSection
- GlobalSection(ExtensibilityAddIns) = postSolution
- EndGlobalSection
-EndGlobal
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tools", "Tools\Tools.vcproj", "{6CAE7F4D-C27B-43F3-B30A-84C5F32EFA29}"
+ ProjectSection(ProjectDependencies) = postProject
+ {0A2CD193-F270-4F2B-943C-F8BDF792D25C} = {0A2CD193-F270-4F2B-943C-F8BDF792D25C}
+ {879D8D90-9A7E-4F3C-9B4E-F1648C8AE927} = {879D8D90-9A7E-4F3C-9B4E-F1648C8AE927}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mogltk", "mogltk\mogltk.vcproj", "{34BCDA3E-D3E2-4A8D-BF73-7D770EE6966A}"
+ ProjectSection(ProjectDependencies) = postProject
+ {879D8D90-9A7E-4F3C-9B4E-F1648C8AE927} = {879D8D90-9A7E-4F3C-9B4E-F1648C8AE927}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Dalos", "Dalos\Dalos.vcproj", "{22F8F8CD-B256-446D-9B42-09CE83F74885}"
+ ProjectSection(ProjectDependencies) = postProject
+ {0A2CD193-F270-4F2B-943C-F8BDF792D25C} = {0A2CD193-F270-4F2B-943C-F8BDF792D25C}
+ {879D8D90-9A7E-4F3C-9B4E-F1648C8AE927} = {879D8D90-9A7E-4F3C-9B4E-F1648C8AE927}
+ {34BCDA3E-D3E2-4A8D-BF73-7D770EE6966A} = {34BCDA3E-D3E2-4A8D-BF73-7D770EE6966A}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Baltisot - generic", "Baltisot - generic\Baltisot - generic.vcproj", "{879D8D90-9A7E-4F3C-9B4E-F1648C8AE927}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PSX-Bundle - library", "PSX-Bundle - library\PSX-Bundle - library.vcproj", "{0A2CD193-F270-4F2B-943C-F8BDF792D25C}"
+ ProjectSection(ProjectDependencies) = postProject
+ {879D8D90-9A7E-4F3C-9B4E-F1648C8AE927} = {879D8D90-9A7E-4F3C-9B4E-F1648C8AE927}
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Release = Release
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {6CAE7F4D-C27B-43F3-B30A-84C5F32EFA29}.Debug.ActiveCfg = Debug|Win32
+ {6CAE7F4D-C27B-43F3-B30A-84C5F32EFA29}.Debug.Build.0 = Debug|Win32
+ {6CAE7F4D-C27B-43F3-B30A-84C5F32EFA29}.Release.ActiveCfg = Release|Win32
+ {6CAE7F4D-C27B-43F3-B30A-84C5F32EFA29}.Release.Build.0 = Release|Win32
+ {34BCDA3E-D3E2-4A8D-BF73-7D770EE6966A}.Debug.ActiveCfg = Debug|Win32
+ {34BCDA3E-D3E2-4A8D-BF73-7D770EE6966A}.Debug.Build.0 = Debug|Win32
+ {34BCDA3E-D3E2-4A8D-BF73-7D770EE6966A}.Release.ActiveCfg = Release|Win32
+ {34BCDA3E-D3E2-4A8D-BF73-7D770EE6966A}.Release.Build.0 = Release|Win32
+ {22F8F8CD-B256-446D-9B42-09CE83F74885}.Debug.ActiveCfg = Debug|Win32
+ {22F8F8CD-B256-446D-9B42-09CE83F74885}.Debug.Build.0 = Debug|Win32
+ {22F8F8CD-B256-446D-9B42-09CE83F74885}.Release.ActiveCfg = Release|Win32
+ {22F8F8CD-B256-446D-9B42-09CE83F74885}.Release.Build.0 = Release|Win32
+ {879D8D90-9A7E-4F3C-9B4E-F1648C8AE927}.Debug.ActiveCfg = Debug|Win32
+ {879D8D90-9A7E-4F3C-9B4E-F1648C8AE927}.Debug.Build.0 = Debug|Win32
+ {879D8D90-9A7E-4F3C-9B4E-F1648C8AE927}.Release.ActiveCfg = Release|Win32
+ {879D8D90-9A7E-4F3C-9B4E-F1648C8AE927}.Release.Build.0 = Release|Win32
+ {0A2CD193-F270-4F2B-943C-F8BDF792D25C}.Debug.ActiveCfg = Debug|Win32
+ {0A2CD193-F270-4F2B-943C-F8BDF792D25C}.Debug.Build.0 = Debug|Win32
+ {0A2CD193-F270-4F2B-943C-F8BDF792D25C}.Release.ActiveCfg = Release|Win32
+ {0A2CD193-F270-4F2B-943C-F8BDF792D25C}.Release.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/MSVC/Tools/Tools.vcproj b/MSVC/Tools/Tools.vcproj
index 31a5091..f3eaad4 100644
--- a/MSVC/Tools/Tools.vcproj
+++ b/MSVC/Tools/Tools.vcproj
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding = "Windows-1252"?>
+<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="7.00"
+ Version="7.10"
Name="Tools"
ProjectGUID="{6CAE7F4D-C27B-43F3-B30A-84C5F32EFA29}"
Keyword="MakeFileProj">
@@ -33,6 +33,8 @@
CleanCommandLine="nmake clean"/>
</Configuration>
</Configurations>
+ <References>
+ </References>
<Files>
<Filter
Name="Common tools"
@@ -69,10 +71,10 @@
Name="Xenogears tools"
Filter="">
<File
- RelativePath="..\..\Xenogears\Decrypt.cpp">
+ RelativePath="..\..\Xenogears\compil.lex">
</File>
<File
- RelativePath="..\..\Xenogears\compil.lex">
+ RelativePath="..\..\Xenogears\Decrypt.cpp">
</File>
<File
RelativePath="..\..\Xenogears\main_dump.cpp">
@@ -93,23 +95,23 @@
Name="Helpers"
Filter="">
<File
- RelativePath="..\..\Xenogears\XenoCD1.map">
+ RelativePath="..\..\Xenogears\map2sqr">
</File>
<File
- RelativePath="..\..\Xenogears\XenoCD2.map">
+ RelativePath="..\..\Xenogears\XenoCD1.map">
</File>
<File
- RelativePath="..\..\Xenogears\map2sqr">
+ RelativePath="..\..\Xenogears\XenoCD2.map">
</File>
</Filter>
</Filter>
<Filter
Name="Global Makefiles">
<File
- RelativePath="MakInDir.bat">
+ RelativePath="makefile">
</File>
<File
- RelativePath="makefile">
+ RelativePath="MakInDir.bat">
</File>
<File
RelativePath="master.mak">
@@ -174,11 +176,11 @@
</File>
</Filter>
<File
- RelativePath="Links.htm"
- DeploymentContent="TRUE">
+ RelativePath="..\..\cdrom.ico">
</File>
<File
- RelativePath="..\..\cdrom.ico">
+ RelativePath="Links.htm"
+ DeploymentContent="TRUE">
</File>
</Files>
<Globals>
diff --git a/MSVC/mogltk/mogltk.vcproj b/MSVC/mogltk/mogltk.vcproj
index c4ea69b..c7a7d35 100644
--- a/MSVC/mogltk/mogltk.vcproj
+++ b/MSVC/mogltk/mogltk.vcproj
@@ -1,202 +1,216 @@
-<?xml version="1.0" encoding = "Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.00"
- Name="mogltk"
- ProjectGUID="{34BCDA3E-D3E2-4A8D-BF73-7D770EE6966A}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="Debug"
- IntermediateDirectory="Debug"
- ConfigurationType="4"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="..\..\mogltk\include;..\..\generic\include;&quot;..\..\..\SDL-1.2.7\include&quot;;..\..\generic\lib\zlib\include;..\..\generic\lib\lua\include"
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="5"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)/mogltk.lib"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="Release"
- IntermediateDirectory="Release"
- ConfigurationType="4"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- InlineFunctionExpansion="1"
- OmitFramePointers="TRUE"
- AdditionalIncludeDirectories="..\..\mogltk\include;..\..\generic\include;&quot;..\..\..\SDL-1.2.7\include&quot;;..\..\generic\lib\zlib\include;..\..\generic\lib\lua\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
- StringPooling="TRUE"
- RuntimeLibrary="4"
- EnableFunctionLevelLinking="TRUE"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)/mogltk.lib"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- </Configuration>
- </Configurations>
- <Files>
- <Filter
- Name="base"
- Filter="">
- <File
- RelativePath="..\..\mogltk\lib\base.cc">
- </File>
- <File
- RelativePath="..\..\mogltk\include\base.h">
- </File>
- <File
- RelativePath="..\..\mogltk\lib\glbase.cc">
- </File>
- <File
- RelativePath="..\..\mogltk\include\glbase.h">
- </File>
- </Filter>
- <Filter
- Name="engine"
- Filter="">
- <File
- RelativePath="..\..\mogltk\lib\engine.cc">
- </File>
- <File
- RelativePath="..\..\mogltk\include\engine.h">
- </File>
- </Filter>
- <Filter
- Name="font"
- Filter="">
- <File
- RelativePath="..\..\mogltk\lib\font.cc">
- </File>
- <File
- RelativePath="..\..\mogltk\include\font.h">
- </File>
- <File
- RelativePath="..\..\mogltk\lib\glfont.cc">
- </File>
- <File
- RelativePath="..\..\mogltk\include\glfont.h">
- </File>
- </Filter>
- <Filter
- Name="mcolor"
- Filter="">
- <File
- RelativePath="..\..\mogltk\lib\mcolor.cc">
- </File>
- <File
- RelativePath="..\..\mogltk\include\mcolor.h">
- </File>
- </Filter>
- <Filter
- Name="shape"
- Filter="">
- <File
- RelativePath="..\..\mogltk\lib\glshape.cc">
- </File>
- <File
- RelativePath="..\..\mogltk\include\glshape.h">
- </File>
- <File
- RelativePath="..\..\mogltk\lib\shape.cc">
- </File>
- <File
- RelativePath="..\..\mogltk\include\shape.h">
- </File>
- </Filter>
- <Filter
- Name="sprite"
- Filter="">
- <File
- RelativePath="..\..\mogltk\lib\glsprite.cc">
- </File>
- <File
- RelativePath="..\..\mogltk\include\glsprite.h">
- </File>
- <File
- RelativePath="..\..\mogltk\lib\sprite.cc">
- </File>
- <File
- RelativePath="..\..\mogltk\include\sprite.h">
- </File>
- </Filter>
- <Filter
- Name="texture"
- Filter="">
- <File
- RelativePath="..\..\mogltk\lib\texture.cc">
- </File>
- <File
- RelativePath="..\..\mogltk\include\texture.h">
- </File>
- </Filter>
- <Filter
- Name="widgets"
- Filter="">
- <File
- RelativePath="..\..\mogltk\lib\glwidgets.cc">
- </File>
- <File
- RelativePath="..\..\mogltk\include\glwidgets.h">
- </File>
- <File
- RelativePath="..\..\mogltk\lib\widgets.cc">
- </File>
- <File
- RelativePath="..\..\mogltk\include\widgets.h">
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="mogltk"
+ ProjectGUID="{34BCDA3E-D3E2-4A8D-BF73-7D770EE6966A}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="4"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\mogltk\include;..\..\generic\include;&quot;..\..\..\SDL-1.2.7\include&quot;;..\..\generic\lib\zlib\include;..\..\generic\lib\lua\include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="5"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="$(OutDir)/mogltk.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="4"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ AdditionalIncludeDirectories="..\..\mogltk\include;..\..\generic\include;&quot;..\..\..\SDL-1.2.7\include&quot;;..\..\generic\lib\zlib\include;..\..\generic\lib\lua\include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="4"
+ EnableFunctionLevelLinking="TRUE"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="$(OutDir)/mogltk.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="base"
+ Filter="">
+ <File
+ RelativePath="..\..\mogltk\lib\base.cc">
+ </File>
+ <File
+ RelativePath="..\..\mogltk\include\base.h">
+ </File>
+ <File
+ RelativePath="..\..\mogltk\lib\glbase.cc">
+ </File>
+ <File
+ RelativePath="..\..\mogltk\include\glbase.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="engine"
+ Filter="">
+ <File
+ RelativePath="..\..\mogltk\lib\engine.cc">
+ </File>
+ <File
+ RelativePath="..\..\mogltk\include\engine.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="font"
+ Filter="">
+ <File
+ RelativePath="..\..\mogltk\lib\font.cc">
+ </File>
+ <File
+ RelativePath="..\..\mogltk\include\font.h">
+ </File>
+ <File
+ RelativePath="..\..\mogltk\lib\glfont.cc">
+ </File>
+ <File
+ RelativePath="..\..\mogltk\include\glfont.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="mcolor"
+ Filter="">
+ <File
+ RelativePath="..\..\mogltk\lib\mcolor.cc">
+ </File>
+ <File
+ RelativePath="..\..\mogltk\include\mcolor.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="shape"
+ Filter="">
+ <File
+ RelativePath="..\..\mogltk\lib\glshape.cc">
+ </File>
+ <File
+ RelativePath="..\..\mogltk\include\glshape.h">
+ </File>
+ <File
+ RelativePath="..\..\mogltk\lib\shape.cc">
+ </File>
+ <File
+ RelativePath="..\..\mogltk\include\shape.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="sprite"
+ Filter="">
+ <File
+ RelativePath="..\..\mogltk\lib\glsprite.cc">
+ </File>
+ <File
+ RelativePath="..\..\mogltk\include\glsprite.h">
+ </File>
+ <File
+ RelativePath="..\..\mogltk\lib\sprite.cc">
+ </File>
+ <File
+ RelativePath="..\..\mogltk\include\sprite.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="texture"
+ Filter="">
+ <File
+ RelativePath="..\..\mogltk\lib\texture.cc">
+ </File>
+ <File
+ RelativePath="..\..\mogltk\include\texture.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="widgets"
+ Filter="">
+ <File
+ RelativePath="..\..\mogltk\lib\glwidgets.cc">
+ </File>
+ <File
+ RelativePath="..\..\mogltk\include\glwidgets.h">
+ </File>
+ <File
+ RelativePath="..\..\mogltk\lib\widgets.cc">
+ </File>
+ <File
+ RelativePath="..\..\mogltk\include\widgets.h">
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/lib/isobuilder.cpp b/lib/isobuilder.cpp
index 3f31c73..1414e96 100644
--- a/lib/isobuilder.cpp
+++ b/lib/isobuilder.cpp
@@ -1,872 +1,872 @@
-/*
- * PSX-Tools Bundle Pack
- * Copyright (C) 2002-2003 Nicolas "Pixel" Noble
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/* $Id: isobuilder.cpp,v 1.12 2004-05-03 12:55:04 pixel Exp $ */
-
-#include "isobuilder.h"
-
-void isobuilder::Date::dump(Byte * datas) {
- char pbuf[256];
-
- sprintf(pbuf, "%04i", year);
- memcpy(datas + 0, pbuf, 4);
- sprintf(pbuf, "%02i", month);
- memcpy(datas + 4, pbuf, 2);
- sprintf(pbuf, "%02i", day);
- memcpy(datas + 6, pbuf, 2);
- sprintf(pbuf, "%02i", hour);
- memcpy(datas + 8, pbuf, 2);
- sprintf(pbuf, "%02i", minute);
- memcpy(datas + 10, pbuf, 2);
- sprintf(pbuf, "%02i", second);
- memcpy(datas + 12, pbuf, 2);
- sprintf(pbuf, "%02i", hundredths);
- memcpy(datas + 14, pbuf, 2);
-
- *((char *) (datas + 16)) = offset;
-}
-
-isobuilder::Date::Date(int) {
- year = month = day = hour = minute = second = hundredths = offset = 0;
-}
-
-isobuilder::Date::Date(Byte * datas) {
- char pbuf[256];
- char * cdatas = (char *) datas;
-
- memcpy(pbuf, cdatas + 0, 4);
- pbuf[4] = 0;
- sscanf(pbuf, "%d", &year);
-
- memcpy(pbuf, cdatas + 4, 2);
- pbuf[2] = 0;
- sscanf(pbuf, "%d", &month);
-
- memcpy(pbuf, cdatas + 6, 2);
- pbuf[2] = 0;
- sscanf(pbuf, "%d", &day);
-
- memcpy(pbuf, cdatas + 8, 2);
- pbuf[2] = 0;
- sscanf(pbuf, "%d", &hour);
-
- memcpy(pbuf, cdatas + 10, 2);
- pbuf[2] = 0;
- sscanf(pbuf, "%d", &minute);
-
- memcpy(pbuf, cdatas + 12, 2);
- pbuf[2] = 0;
- sscanf(pbuf, "%d", &second);
-
- memcpy(pbuf, cdatas + 14, 2);
- pbuf[2] = 0;
- sscanf(pbuf, "%d", &hundredths);
-
- offset = *(cdatas + 16);
-}
-
-isobuilder::DirTree::DirTree(isobuilder::DirTree * _father, bool _dir) : mode(-1), father(_father), dir(_dir) {
- DirTree * p;
-
- child = brother = 0;
-
- if (!father)
- return;
-
- creation = father->creation;
-
- if (father->child) {
- for (p = father->child; p->brother; p = p->brother);
- p->brother = this;
- } else {
- father->child = this;
- }
-}
-
-isobuilder::DirTree::~DirTree() {
- while (child) {
- delete child;
- }
-
- if (!father)
- return;
-
- if (father->child == this) {
- father->child = brother;
- } else {
- // Dirty, should not happen.
- DirTree * p;
- for (p = father->child; p->brother != this; p = p->brother);
- p->brother = brother;
- }
-}
-
-void isobuilder::DirTree::dumpdirs(isobuilder * builder) throw (GeneralException) {
- Byte * dir, * odir;
- int cursiz, cursectsize, R;
- String oldname;
- DirTree * p;
-
- odir = dir = (Byte *) malloc(cursiz = size);
- cursectsize = 2048;
-
- oldname = name;
- name = ".";
- R = buildentry(dir, cursectsize);
- name = oldname;
- cursectsize -= R;
- dir += R;
-
- if (father) {
- oldname = father->name;
- father->name = "..";
- R = father->buildentry(dir, cursectsize);
- father->name = oldname;
- } else {
- name = "..";
- R = buildentry(dir, cursectsize);
- name = ".";
- }
-
- cursectsize -= R;
- dir += R;
-
- for (p = child; p; p = p->brother) {
- if (p->dir) {
- p->dumpdirs(builder);
- }
- if (p->hardhide)
- continue;
- while (!(R = p->buildentry(dir, cursectsize))) {
- cursiz -= 2048;
- dir += cursectsize;
- cursectsize = 2048;
- if (!cursiz)
- throw GeneralException("Directory is too small! Entries don't fit.");
- }
- cursectsize -= R;
- dir += R;
- }
-
- builder->putdatas(odir, size, mode, sector);
-
- free(odir);
-}
-
-int isobuilder::DirTree::buildpath(Byte * datas, int size, bool bigendian) throw (GeneralException) {
- int N, r, tr;
- Uint16 pn;
- char pbuf[256], pad;
-
- if (!dir) {
- if (brother) {
- return brother->buildpath(datas, size, bigendian);
- } else {
- return 0;
- }
- }
-
- if (!father) {
- numerate(1);
- N = 1;
- pbuf[0] = 0;
- pn = 1;
- } else {
- N = name.strlen();
- strcpy(pbuf, name.to_charp());
- pn = father->node;
- }
-
- pad = N & 1;
- size -= (r = N + pad + 8);
-
- if (size < 0)
- throw GeneralException("Path table too small.");
-
- datas[0] = N;
- datas[1] = 0;
- *((Uint32 *) (datas + 2)) = bigendian ? cdutils::swap_dword(sector) : sector;
- *((Uint16 *) (datas + 6)) = bigendian ? cdutils::swap_word(pn) : pn;
- memcpy(datas + 8, pbuf, N);
- if (pad)
- datas[8 + N] = 0;
-
- datas += r;
-
- if (brother) {
- tr = brother->buildpath(datas, size, bigendian);
- r += tr;
- size -= tr;
- datas += tr;
- }
-
- if (child) {
- tr = child->buildpath(datas, size, bigendian);
- r += tr;
- size -= tr;
- datas += tr;
- }
-
- return r;
-}
-
-int isobuilder::DirTree::buildentry(Byte * buffer, int spaceleft, bool put_xa) {
- int N, R;
- char pbuf[256], pad;
- Byte * p;
- cdutils::DirEntry * d = (cdutils::DirEntry *) buffer;
-
- put_xa = put_xa && have_xa;
-
- memset(pbuf, 0, 256);
-
- if (name == ".") {
- N = 1;
- pbuf[0] = 0;
- } else if (name == "..") {
- N = 1;
- pbuf[0] = 1;
- } else {
- strcpy(pbuf, name.to_charp());
- N = name.strlen();
- if (!dir) {
- N += 2;
- strcat(pbuf, ";1");
- }
- }
-
- R = N + 33;
-
- if (R & 1) {
- R++;
- pad = 1;
- } else {
- pad = 0;
- }
-
- if (put_xa) {
- R += 14;
- p = (Byte *) pbuf + N + pad;
- p[4] = 0x05;
- p[5] = 0x55;
- p[6] = 'X';
- p[7] = 'A';
-
- p[4] |= xa_dir ? 0x80 : 0;
- p[4] |= xa_audio ? 0x40 : 0;
- p[4] |= xa_str ? 0x20 : 0;
- p[4] |= xa_xa ? 0x10 : 0;
- p[4] |= xa_form1 ? 0x08 : 0;
- }
-
- if (R > spaceleft) {
- return 0;
- }
-
- memset(d, 0, R);
-
- d->R = R;
- d->N = N;
- memcpy(d->id, pbuf, N + pad + (put_xa ? 14 : 0));
-
- d->Sector = sector;
- d->BESector = cdutils::swap_dword(sector);
- d->Size = size;
- d->BESize = cdutils::swap_dword(size);
- d->Year = creation.year - 1900;
- d->Month = creation.month;
- d->Day = creation.day;
- d->Hour = creation.hour;
- d->Minute = creation.minute;
- d->Second = creation.second;
- d->Offset = creation.offset;
- d->Flags |= hidden ? 1 : 0;
- d->Flags |= dir ? 2 : 0;
-
- return R;
-}
-
-void isobuilder::DirTree::fromdir(cdutils::DirEntry * d) {
- Date t;
- char pbuf[200], pad;
- int s;
- if ((!d) || (!d->R)) {
- return;
- }
-
- if ((d->N == 1) && (d->id[0] == 0)) {
- name = ".";
- } else if ((d->N == 1) && (d->id[0] == 1)) {
- name = "..";
- } else {
- memcpy(pbuf, d->id, s = (d->N - ((d->Flags & 2) ? 0 : 2)));
- pbuf[s] = 0;
- name = pbuf;
- }
- hidden = d->Flags & 1;
- if (d->Year < 70)
- d->Year += 100;
- t.year = d->Year;
- t.month = d->Month;
- t.day = d->Day;
- t.hour = d->Hour;
- t.second = d->Second;
- t.hundredths = 0;
- t.offset = d->Offset;
- creation = t;
-
- s = 33 + d->N;
- if (s & 1) {
- s++;
- pad = 1;
- } else {
- pad = 0;
- }
- if (s != d->R) {
- if ((s + 14) == d->R) {
- Byte * p;
- p = (Byte *) d->id + d->N + pad;
- if ((p[6] == 'X') && (p[7] == 'A')) {
- have_xa = true;
- xa_dir = p[4] & 0x80;
- xa_audio = p[4] & 0x40;
- xa_str = p[4] & 0x20;
- xa_xa = p[4] & 0x10;
- xa_form1 = p[4] & 0x08;
- }
- }
- }
-}
-
-bool isobuilder::DirTree::isdir() {
- return dir;
-}
-
-void isobuilder::DirTree::setbasicsxa() {
- have_xa = true;
- if (dir)
- xa_dir = true;
- xa_form1 = true;
-}
-
-int isobuilder::DirTree::numerate(int n) {
- if (!dir) {
- if (brother) {
- return brother->numerate(n);
- } else {
- return n;
- }
- }
-
- node = n++;
-
- if (brother)
- n = brother->numerate(n);
-
- if (child)
- n = child->numerate(n);
-
- return n;
-}
-
-isobuilder::DirTree * isobuilder::DirTree::Father() {
- return father;
-}
-
-isobuilder::DirTree * isobuilder::DirTree::Brother() {
- return brother;
-}
-
-isobuilder::DirTree * isobuilder::DirTree::Child() {
- return child;
-}
-
-isobuilder::DirTree * isobuilder::DirTree::Find(const String & _name) {
- DirTree * p = 0;
-
- if (name == _name)
- return this;
-
- if (brother)
- p = brother->Find(_name);
-
- if (!p && child)
- return child->Find(_name);
-
- return p;
-}
-
-isobuilder::isobuilder(Handle * _w, int _mode) : w(_w), sector(0), nsectors(0), basics(false), dmode(_mode) {
- Byte sect[2352];
- memset(sect, 0, 2352);
-
- for (int i = 0; i < 16; i++) {
- createsector(sect, MODE2, i);
- }
-}
-
-isobuilder::~isobuilder() {
- if (!closed)
- close();
- if (root)
- delete root;
-}
-
-void isobuilder::foreword(cdutils * cd) {
- Byte sect[2352];
- for (int i = 0; i < 16; i++) {
- cd->read_sector(sect, MODE_RAW, i);
- createsector(sect, MODE_RAW, i);
- }
-}
-
-void isobuilder::foreword(Handle * forewords, int mode) {
- Byte sect[2352];
- for (int i = 0; i < 16; i++) {
- forewords->read(sect, sec_sizes[mode]);
- createsector(sect, mode, i);
- }
-}
-
-void isobuilder::foreword(Byte * forewords, int mode) {
- for (int i = 0; i < 16; i++) {
- createsector(forewords + i * sec_sizes[mode], mode, i);
- }
-}
-
-int isobuilder::getdispsect() {
- return lastdispsect;
-}
-
-int isobuilder::putfile(Handle * file, int mode, int n) {
- Byte datas[2352];
- ssize_t filesize;
- int fsect;
-
- if (mode < 0)
- mode = dmode;
-
- if (n >= 0) {
- sector = n;
- } else {
- sector = lastdispsect;
- }
-
- fsect = sector;
-
- filesize = file->GetSize();
-
- while (filesize > 0) {
- memset(datas, 0, 2352);
- filesize -= file->read(datas, sec_sizes[mode]);
- if ((mode == MODE2_FORM1) || (mode == MODE2_FORM2)) {
- if (filesize) {
- clearEOF();
- } else {
- setEOF();
- }
- }
- createsector(datas, mode);
- }
-
- return fsect;
-}
-
-int isobuilder::putdatas(Byte * _datas, size_t size, int smode, int n) {
- Byte datas[2352];
- size_t eating;
- int dsect;
- if (n >= 0) {
- sector = n;
- } else {
- sector = lastdispsect;
- }
-
- dsect = sector;
-
- if (smode < 0)
- smode = dmode;
-
- while (size > 0) {
- memset(datas, 0, 2352);
- eating = MIN(size, (size_t) sec_sizes[smode]);
- memcpy(datas, _datas, eating);
- size -= eating;
- _datas += eating;
- if ((smode == MODE2_FORM1) || (smode == MODE2_FORM2)) {
- if (size) {
- clearEOF();
- } else {
- setEOF();
- }
- }
- createsector(datas, smode);
- }
-
- return dsect;
-}
-
-int isobuilder::createsector(Byte * datas, int smode, int n) {
- Byte dsector[2352];
- int rsector;
- if (n >= 0)
- sector = n;
-
- if (smode < 0)
- smode = dmode;
-
- rsector = sector;
-
- w->seek(2352 * sector, SEEK_SET);
-
- memcpy(dsector + sec_offsts[smode], datas, sec_sizes[smode]);
-
- if ((smode == MODE2_FORM1) || (smode == MODE2_FORM2)) {
- // Mode 2 Form 2 would be odd, but well....
- dsector[16] = dsector[20] = 0; // File Number
- dsector[17] = dsector[21] = 0; // Channel Number
- dsector[18] = dsector[22] = sub_EOR | sub_EOF | 8 |
- (smode == MODE2_FORM2 ? 32 : 0);
- dsector[19] = dsector[23] = 0; // Coding Info
- }
-
- if (smode != MODE_RAW) {
- sector += 150;
- yazedc_o.minute = cdutils::to_BCD(sector / 60 / 75);
- yazedc_o.second = cdutils::to_BCD((sector / 75) % 60);
- yazedc_o.frame = cdutils::to_BCD(sector % 75);
- sector -= 150;
- yazedc_o.do_encode_L2(dsector, smode, 0);
- }
-
- w->write(dsector, 2352);
-
- sector++;
-
- nsectors = MAX(nsectors, sector);
- lastdispsect = MAX(lastdispsect, sector);
-
- return rsector;
-}
-
-void isobuilder::setEOF() {
- sub_EOF = 128;
- sub_EOR = 1;
-}
-
-void isobuilder::clearEOF() {
- sub_EOF = sub_EOR = 0;
-}
-
-isobuilder::DirTree * isobuilder::setbasics(PVD _pvd, int _rootsize, int _ptsize, int _nvd, int _rootsect) throw (GeneralException) {
- if (basics) {
- throw GeneralException("Basic ISO structures already set");
- }
- basics = true;
-
- pvd = _pvd;
- rootsize = _rootsize;
- ptsize = _ptsize;
- nvd = _nvd;
-
- ptsect = 17 + nvd;
- rootsect = ptsect + ptsize * 4;
- if (_rootsect >= 0)
- rootsect = _rootsect;
- lastdispsect = rootsect + rootsize;
-
- root = new DirTree(0);
- root->name = ".";
- root->creation = pvd.volcreat;
- root->sector = rootsect;
- root->size = rootsize * 2048;
- return root;
-}
-
-isobuilder::DirTree * isobuilder::createdir(DirTree * p, const String & _name, int size, cdutils::DirEntry * d, int mode) throw (GeneralException) {
- DirTree * r;
-
- if (!p)
- throw GeneralException("Empty father");
-
- if (closed)
- throw GeneralException("ISO is closed");
-
- if (!basics)
- throw GeneralException("ISO basis not created (no root!)");
-
- r = new DirTree(p);
-
- r->creation = p->creation;
- if (d)
- r->fromdir(d);
- if (_name != "")
- r->name = _name;
- r->size = size * 2048;
- if (!r->size)
- r->size = d->Size;
- r->sector = lastdispsect;
- if (mode >= 0)
- r->mode = mode;
- else
- r->mode = dmode;
-
- lastdispsect += size;
-
- return r;
-}
-
-isobuilder::DirTree * isobuilder::createfile(DirTree * p, Handle * file, const String & _name, cdutils::DirEntry * d, int mode) throw (GeneralException) {
- DirTree * r;
-
- if (!p)
- throw GeneralException("Empty father");
-
- if (closed)
- throw GeneralException("ISO is closed");
-
- if (!basics)
- throw GeneralException("ISO basis not created (no root!)");
-
- r = new DirTree(p, false);
-
- r->name = _name;
- r->creation = p->creation;
- r->fromdir(d);
- if (_name != "")
- r->name = _name;
- r->size = file->GetSize();
- r->sector = putfile(file, mode);
- if (mode >= 0)
- r->mode = mode;
- else
- r->mode = dmode;
-
- return r;
-}
-
-void isobuilder::copydir(isobuilder::DirTree * r, cdutils * cd, cdutils::DirEntry * d, int mode) {
- Byte datas[2048];
- cdutils::DirEntry * p;
- int nsectors = d->Size / 2048, ssize, c = 0;
- int fsize, osize;
-
- if (mode < 0)
- mode = dmode;
-
- while (nsectors) {
- cd->read_sector(datas, mode, d->Sector + c++);
- nsectors--;
- p = (cdutils::DirEntry *) datas;
- ssize = 2048;
- while ((ssize) && (p->R)) {
- ssize -= p->R;
- char pbuf[256];
- memcpy(pbuf, p->id, p->N);
- pbuf[p->N] = 0;
- if (p->Flags & 2) {
- if (!((p->N == 1) && ((p->id[0] == 0) || (p->id[0] == 1))))
- copydir(createdir(r, "", p->Size / 2048, p, mode), cd, p, mode);
- } else {
- printm(M_INFO, "Dupping %s\n", pbuf);
- int fmode;
- osize = fsize = p->Size;
- if (mode == MODE1) {
- fmode = mode;
- } else {
- fmode = MODE2_FORM1;
- int s, pad;
- s = 33 + p->N;
- if (s & 1) {
- s++;
- pad = 1;
- } else {
- pad = 0;
- }
- if ((s != p->R) && ((s + 14) == p->R)) {
- if (!(p->id[p->N + pad + 4] & 8)) {
- fmode = MODE2;
- fsize = (p->Size / 2048) * 2336;
- }
- }
- }
- p->Size = fsize;
- cdfile * tmp = new cdfile(cd, p, fmode);
- createfile(r, tmp, "", p, fmode)->size = osize;
- delete tmp;
- p->Size = osize;
- }
- p = (cdutils::DirEntry *) (((Byte *) p) + p->R);
- }
- }
-}
-
-isobuilder::PVD isobuilder::createpvd(Handle * f) {
- Byte datas[2048];
- f->read(datas, 2048);
- return createpvd(datas);
-}
-
-isobuilder::PVD isobuilder::createpvd(cdutils * cd) {
- Byte datas[2048];
- cd->read_sector(datas, GUESS, 16);
- return createpvd(datas);
-}
-
-isobuilder::PVD isobuilder::createpvd(Byte * buffer) {
- PVD r;
- char pbuff[256];
-
- memcpy(pbuff, buffer + 8, 32);
- pbuff[32] = 0;
- r.sysid = pbuff;
- r.sysid.rtrim();
- memcpy(pbuff, buffer + 40, 32);
- pbuff[32] = 0;
- r.volid = pbuff;
- r.volid.rtrim();
- memcpy(pbuff, buffer + 190, 128);
- pbuff[128] = 0;
- r.volsetid = pbuff;
- r.volsetid.rtrim();
- memcpy(pbuff, buffer + 318, 128);
- pbuff[128] = 0;
- r.pubid = pbuff;
- r.pubid.rtrim();
- memcpy(pbuff, buffer + 446, 128);
- pbuff[128] = 0;
- r.prepid = pbuff;
- r.prepid.rtrim();
- memcpy(pbuff, buffer + 574, 128);
- pbuff[128] = 0;
- r.appid = pbuff;
- r.appid.rtrim();
- memcpy(pbuff, buffer + 702, 37);
- pbuff[37] = 0;
- r.copyright = pbuff;
- r.copyright.rtrim();
- memcpy(pbuff, buffer + 739, 37);
- pbuff[37] = 0;
- r.abstract = pbuff;
- r.abstract.rtrim();
- memcpy(pbuff, buffer + 776, 37);
- pbuff[37] = 0;
- r.biblio = pbuff;
- r.biblio.rtrim();
-
- r.volcreat = Date(buffer + 813);
- r.modif = Date(buffer + 830);
- r.volexp = Date(buffer + 847);
- r.voleff = Date(buffer + 864);
-
- memcpy(r.appdata, buffer + 883, 512);
-
- return r;
-}
-
-void isobuilder::close(Handle * cue, int mode, int nsects) throw (GeneralException) {
- Byte datas[2048];
- Byte * pdatas;
- char * cdatas = (char *) datas;
- int psize;
-
- if (nsects < 0)
- nsects = nsectors;
-
- memset(datas, 0, 2048);
-
- pdatas = (Byte *) malloc(ptsize * 2048);
- psize = root->buildpath(pdatas, ptsize * 2048);
- putdatas(pdatas, ptsize * 2048, mode, ptsect);
- putdatas(pdatas, ptsize * 2048, mode, ptsect + ptsize);
- root->buildpath(pdatas, ptsize * 2048, true);
- putdatas(pdatas, ptsize * 2048, mode, ptsect + ptsize * 2);
- putdatas(pdatas, ptsize * 2048, mode, ptsect + ptsize * 3);
- free(pdatas);
-
- datas[0] = 1;
- datas[1] = 67;
- datas[2] = 68;
- datas[3] = 48;
- datas[4] = 48;
- datas[5] = 49;
- datas[6] = 1;
- datas[7] = 0;
-
- sprintf(cdatas + 8, "%-32s", pvd.sysid.to_charp());
- sprintf(cdatas + 40, "%-32s", pvd.volid.to_charp());
- *((Uint32 *) (datas + 80)) = nsects;
- *((Uint32 *) (datas + 84)) = cdutils::swap_dword(nsects);
-
- datas[120] = 1;
- datas[121] = 0;
- datas[122] = 0;
- datas[123] = 1;
- datas[124] = 1;
- datas[125] = 0;
- datas[126] = 0;
- datas[127] = 1;
- datas[128] = 0;
- datas[129] = 8;
- datas[130] = 8;
- datas[131] = 0;
- *((Uint32 *) (datas + 132)) = psize;
- *((Uint32 *) (datas + 136)) = cdutils::swap_dword(psize);
- *((Uint32 *) (datas + 140)) = ptsect;
- *((Uint32 *) (datas + 144)) = ptsect + ptsize;
- *((Uint32 *) (datas + 148)) = cdutils::swap_dword(ptsect + ptsize * 2);
- *((Uint32 *) (datas + 152)) = cdutils::swap_dword(ptsect + ptsize * 2);
-
- root->buildentry(datas + 156, 34, false);
-
- sprintf(cdatas + 190, "%-128s", pvd.volsetid.to_charp());
- sprintf(cdatas + 318, "%-128s", pvd.pubid.to_charp());
- sprintf(cdatas + 446, "%-128s", pvd.prepid.to_charp());
- sprintf(cdatas + 574, "%-128s", pvd.appid.to_charp());
- sprintf(cdatas + 702, "%-37s", pvd.copyright.to_charp());
- sprintf(cdatas + 739, "%-37s", pvd.appid.to_charp());
- sprintf(cdatas + 776, "%-37s", pvd.biblio.to_charp());
-
- pvd.volcreat.dump(datas + 813);
- pvd.modif.dump(datas + 830);
- pvd.volexp.dump(datas + 847);
- pvd.voleff.dump(datas + 864);
-
- memcpy(datas + 883, pvd.appdata, 512);
-
- clearEOF();
- sub_EOR = 1;
- createsector(datas, mode, 16);
-
- memset(datas, 0, 2048);
- datas[0] =255;
- datas[1] = 67;
- datas[2] = 68;
- datas[3] = 48;
- datas[4] = 48;
- datas[5] = 49;
- datas[6] = 1;
-
- setEOF();
- createsector(datas, mode);
-
- root->dumpdirs(this);
-
- closed = true;
-}
+/*
+ * PSX-Tools Bundle Pack
+ * Copyright (C) 2002-2003 Nicolas "Pixel" Noble
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* $Id: isobuilder.cpp,v 1.13 2004-10-19 01:27:29 pixel Exp $ */
+
+#include "isobuilder.h"
+
+void isobuilder::Date::dump(Byte * datas) {
+ char pbuf[256];
+
+ sprintf(pbuf, "%04i", year);
+ memcpy(datas + 0, pbuf, 4);
+ sprintf(pbuf, "%02i", month);
+ memcpy(datas + 4, pbuf, 2);
+ sprintf(pbuf, "%02i", day);
+ memcpy(datas + 6, pbuf, 2);
+ sprintf(pbuf, "%02i", hour);
+ memcpy(datas + 8, pbuf, 2);
+ sprintf(pbuf, "%02i", minute);
+ memcpy(datas + 10, pbuf, 2);
+ sprintf(pbuf, "%02i", second);
+ memcpy(datas + 12, pbuf, 2);
+ sprintf(pbuf, "%02i", hundredths);
+ memcpy(datas + 14, pbuf, 2);
+
+ *((char *) (datas + 16)) = offset;
+}
+
+isobuilder::Date::Date(int) {
+ year = month = day = hour = minute = second = hundredths = offset = 0;
+}
+
+isobuilder::Date::Date(Byte * datas) {
+ char pbuf[256];
+ char * cdatas = (char *) datas;
+
+ memcpy(pbuf, cdatas + 0, 4);
+ pbuf[4] = 0;
+ sscanf(pbuf, "%d", &year);
+
+ memcpy(pbuf, cdatas + 4, 2);
+ pbuf[2] = 0;
+ sscanf(pbuf, "%d", &month);
+
+ memcpy(pbuf, cdatas + 6, 2);
+ pbuf[2] = 0;
+ sscanf(pbuf, "%d", &day);
+
+ memcpy(pbuf, cdatas + 8, 2);
+ pbuf[2] = 0;
+ sscanf(pbuf, "%d", &hour);
+
+ memcpy(pbuf, cdatas + 10, 2);
+ pbuf[2] = 0;
+ sscanf(pbuf, "%d", &minute);
+
+ memcpy(pbuf, cdatas + 12, 2);
+ pbuf[2] = 0;
+ sscanf(pbuf, "%d", &second);
+
+ memcpy(pbuf, cdatas + 14, 2);
+ pbuf[2] = 0;
+ sscanf(pbuf, "%d", &hundredths);
+
+ offset = *(cdatas + 16);
+}
+
+isobuilder::DirTree::DirTree(isobuilder::DirTree * _father, bool _dir) : mode(-1), father(_father), dir(_dir) {
+ DirTree * p;
+
+ child = brother = 0;
+
+ if (!father)
+ return;
+
+ creation = father->creation;
+
+ if (father->child) {
+ for (p = father->child; p->brother; p = p->brother);
+ p->brother = this;
+ } else {
+ father->child = this;
+ }
+}
+
+isobuilder::DirTree::~DirTree() {
+ while (child) {
+ delete child;
+ }
+
+ if (!father)
+ return;
+
+ if (father->child == this) {
+ father->child = brother;
+ } else {
+ // Dirty, should not happen.
+ DirTree * p;
+ for (p = father->child; p->brother != this; p = p->brother);
+ p->brother = brother;
+ }
+}
+
+void isobuilder::DirTree::dumpdirs(isobuilder * builder) throw (GeneralException) {
+ Byte * dir, * odir;
+ int cursiz, cursectsize, R;
+ String oldname;
+ DirTree * p;
+
+ odir = dir = (Byte *) malloc(cursiz = size);
+ cursectsize = 2048;
+
+ oldname = name;
+ name = ".";
+ R = buildentry(dir, cursectsize);
+ name = oldname;
+ cursectsize -= R;
+ dir += R;
+
+ if (father) {
+ oldname = father->name;
+ father->name = "..";
+ R = father->buildentry(dir, cursectsize);
+ father->name = oldname;
+ } else {
+ name = "..";
+ R = buildentry(dir, cursectsize);
+ name = ".";
+ }
+
+ cursectsize -= R;
+ dir += R;
+
+ for (p = child; p; p = p->brother) {
+ if (p->dir) {
+ p->dumpdirs(builder);
+ }
+ if (p->hardhide)
+ continue;
+ while (!(R = p->buildentry(dir, cursectsize))) {
+ cursiz -= 2048;
+ dir += cursectsize;
+ cursectsize = 2048;
+ if (!cursiz)
+ throw GeneralException("Directory is too small! Entries don't fit.");
+ }
+ cursectsize -= R;
+ dir += R;
+ }
+
+ builder->putdatas(odir, size, mode, sector);
+
+ free(odir);
+}
+
+int isobuilder::DirTree::buildpath(Byte * datas, int size, bool bigendian) throw (GeneralException) {
+ int N, r, tr;
+ Uint16 pn;
+ char pbuf[256], pad;
+
+ if (!dir) {
+ if (brother) {
+ return brother->buildpath(datas, size, bigendian);
+ } else {
+ return 0;
+ }
+ }
+
+ if (!father) {
+ numerate(1);
+ N = 1;
+ pbuf[0] = 0;
+ pn = 1;
+ } else {
+ N = name.strlen();
+ strcpy(pbuf, name.to_charp());
+ pn = father->node;
+ }
+
+ pad = N & 1;
+ size -= (r = N + pad + 8);
+
+ if (size < 0)
+ throw GeneralException("Path table too small.");
+
+ datas[0] = N;
+ datas[1] = 0;
+ *((Uint32 *) (datas + 2)) = bigendian ? cdutils::swap_dword(sector) : sector;
+ *((Uint16 *) (datas + 6)) = bigendian ? cdutils::swap_word(pn) : pn;
+ memcpy(datas + 8, pbuf, N);
+ if (pad)
+ datas[8 + N] = 0;
+
+ datas += r;
+
+ if (brother) {
+ tr = brother->buildpath(datas, size, bigendian);
+ r += tr;
+ size -= tr;
+ datas += tr;
+ }
+
+ if (child) {
+ tr = child->buildpath(datas, size, bigendian);
+ r += tr;
+ size -= tr;
+ datas += tr;
+ }
+
+ return r;
+}
+
+int isobuilder::DirTree::buildentry(Byte * buffer, int spaceleft, bool put_xa) {
+ int N, R;
+ char pbuf[256], pad;
+ Byte * p;
+ cdutils::DirEntry * d = (cdutils::DirEntry *) buffer;
+
+ put_xa = put_xa && have_xa;
+
+ memset(pbuf, 0, 256);
+
+ if (name == ".") {
+ N = 1;
+ pbuf[0] = 0;
+ } else if (name == "..") {
+ N = 1;
+ pbuf[0] = 1;
+ } else {
+ strcpy(pbuf, name.to_charp());
+ N = name.strlen();
+ if (!dir) {
+ N += 2;
+ strcat(pbuf, ";1");
+ }
+ }
+
+ R = N + 33;
+
+ if (R & 1) {
+ R++;
+ pad = 1;
+ } else {
+ pad = 0;
+ }
+
+ if (put_xa) {
+ R += 14;
+ p = (Byte *) pbuf + N + pad;
+ p[4] = 0x05;
+ p[5] = 0x55;
+ p[6] = 'X';
+ p[7] = 'A';
+
+ p[4] |= xa_dir ? 0x80 : 0;
+ p[4] |= xa_audio ? 0x40 : 0;
+ p[4] |= xa_str ? 0x20 : 0;
+ p[4] |= xa_xa ? 0x10 : 0;
+ p[4] |= xa_form1 ? 0x08 : 0;
+ }
+
+ if (R > spaceleft) {
+ return 0;
+ }
+
+ memset(d, 0, R);
+
+ d->R = R;
+ d->N = N;
+ memcpy(d->id, pbuf, N + pad + (put_xa ? 14 : 0));
+
+ d->Sector = sector;
+ d->BESector = cdutils::swap_dword(sector);
+ d->Size = size;
+ d->BESize = cdutils::swap_dword(size);
+ d->Year = creation.year - 1900;
+ d->Month = creation.month;
+ d->Day = creation.day;
+ d->Hour = creation.hour;
+ d->Minute = creation.minute;
+ d->Second = creation.second;
+ d->Offset = creation.offset;
+ d->Flags |= hidden ? 1 : 0;
+ d->Flags |= dir ? 2 : 0;
+
+ return R;
+}
+
+void isobuilder::DirTree::fromdir(cdutils::DirEntry * d) {
+ Date t;
+ char pbuf[200], pad;
+ int s;
+ if ((!d) || (!d->R)) {
+ return;
+ }
+
+ if ((d->N == 1) && (d->id[0] == 0)) {
+ name = ".";
+ } else if ((d->N == 1) && (d->id[0] == 1)) {
+ name = "..";
+ } else {
+ memcpy(pbuf, d->id, s = (d->N - ((d->Flags & 2) ? 0 : 2)));
+ pbuf[s] = 0;
+ name = pbuf;
+ }
+ hidden = d->Flags & 1;
+ if (d->Year < 70)
+ d->Year += 100;
+ t.year = d->Year;
+ t.month = d->Month;
+ t.day = d->Day;
+ t.hour = d->Hour;
+ t.second = d->Second;
+ t.hundredths = 0;
+ t.offset = d->Offset;
+ creation = t;
+
+ s = 33 + d->N;
+ if (s & 1) {
+ s++;
+ pad = 1;
+ } else {
+ pad = 0;
+ }
+ if (s != d->R) {
+ if ((s + 14) == d->R) {
+ Byte * p;
+ p = (Byte *) d->id + d->N + pad;
+ if ((p[6] == 'X') && (p[7] == 'A')) {
+ have_xa = true;
+ xa_dir = p[4] & 0x80;
+ xa_audio = p[4] & 0x40;
+ xa_str = p[4] & 0x20;
+ xa_xa = p[4] & 0x10;
+ xa_form1 = p[4] & 0x08;
+ }
+ }
+ }
+}
+
+bool isobuilder::DirTree::isdir() {
+ return dir;
+}
+
+void isobuilder::DirTree::setbasicsxa() {
+ have_xa = true;
+ if (dir)
+ xa_dir = true;
+ xa_form1 = true;
+}
+
+int isobuilder::DirTree::numerate(int n) {
+ if (!dir) {
+ if (brother) {
+ return brother->numerate(n);
+ } else {
+ return n;
+ }
+ }
+
+ node = n++;
+
+ if (brother)
+ n = brother->numerate(n);
+
+ if (child)
+ n = child->numerate(n);
+
+ return n;
+}
+
+isobuilder::DirTree * isobuilder::DirTree::Father() {
+ return father;
+}
+
+isobuilder::DirTree * isobuilder::DirTree::Brother() {
+ return brother;
+}
+
+isobuilder::DirTree * isobuilder::DirTree::Child() {
+ return child;
+}
+
+isobuilder::DirTree * isobuilder::DirTree::Find(const String & _name) {
+ DirTree * p = 0;
+
+ if (name == _name)
+ return this;
+
+ if (brother)
+ p = brother->Find(_name);
+
+ if (!p && child)
+ return child->Find(_name);
+
+ return p;
+}
+
+isobuilder::isobuilder(Handle * _w, int _mode) : w(_w), sector(0), nsectors(0), basics(false), dmode(_mode) {
+ Byte sect[2352];
+ memset(sect, 0, 2352);
+
+ for (int i = 0; i < 16; i++) {
+ createsector(sect, MODE2, i);
+ }
+}
+
+isobuilder::~isobuilder() {
+ if (!closed)
+ close();
+ if (root)
+ delete root;
+}
+
+void isobuilder::foreword(cdutils * cd) {
+ Byte sect[2352];
+ for (int i = 0; i < 16; i++) {
+ cd->read_sector(sect, MODE_RAW, i);
+ createsector(sect, MODE_RAW, i);
+ }
+}
+
+void isobuilder::foreword(Handle * forewords, int mode) {
+ Byte sect[2352];
+ for (int i = 0; i < 16; i++) {
+ forewords->read(sect, sec_sizes[mode]);
+ createsector(sect, mode, i);
+ }
+}
+
+void isobuilder::foreword(Byte * forewords, int mode) {
+ for (int i = 0; i < 16; i++) {
+ createsector(forewords + i * sec_sizes[mode], mode, i);
+ }
+}
+
+int isobuilder::getdispsect() {
+ return lastdispsect;
+}
+
+int isobuilder::putfile(Handle * file, int mode, int n) {
+ Byte datas[2352];
+ ssize_t filesize;
+ int fsect;
+
+ if (mode < 0)
+ mode = dmode;
+
+ if (n >= 0) {
+ sector = n;
+ } else {
+ sector = lastdispsect;
+ }
+
+ fsect = sector;
+
+ filesize = file->GetSize();
+
+ while (filesize > 0) {
+ memset(datas, 0, 2352);
+ filesize -= file->read(datas, sec_sizes[mode]);
+ if ((mode == MODE2_FORM1) || (mode == MODE2_FORM2)) {
+ if (filesize) {
+ clearEOF();
+ } else {
+ setEOF();
+ }
+ }
+ createsector(datas, mode);
+ }
+
+ return fsect;
+}
+
+int isobuilder::putdatas(Byte * _datas, size_t size, int smode, int n) {
+ Byte datas[2352];
+ size_t eating;
+ int dsect;
+ if (n >= 0) {
+ sector = n;
+ } else {
+ sector = lastdispsect;
+ }
+
+ dsect = sector;
+
+ if (smode < 0)
+ smode = dmode;
+
+ while (size > 0) {
+ memset(datas, 0, 2352);
+ eating = MIN(size, (size_t) sec_sizes[smode]);
+ memcpy(datas, _datas, eating);
+ size -= eating;
+ _datas += eating;
+ if ((smode == MODE2_FORM1) || (smode == MODE2_FORM2)) {
+ if (size) {
+ clearEOF();
+ } else {
+ setEOF();
+ }
+ }
+ createsector(datas, smode);
+ }
+
+ return dsect;
+}
+
+int isobuilder::createsector(Byte * datas, int smode, int n) {
+ Byte dsector[2352];
+ int rsector;
+ if (n >= 0)
+ sector = n;
+
+ if (smode < 0)
+ smode = dmode;
+
+ rsector = sector;
+
+ w->seek(2352 * sector, SEEK_SET);
+
+ memcpy(dsector + sec_offsts[smode], datas, sec_sizes[smode]);
+
+ if ((smode == MODE2_FORM1) || (smode == MODE2_FORM2)) {
+ // Mode 2 Form 2 would be odd, but well....
+ dsector[16] = dsector[20] = 0; // File Number
+ dsector[17] = dsector[21] = 0; // Channel Number
+ dsector[18] = dsector[22] = sub_EOR | sub_EOF | 8 |
+ (smode == MODE2_FORM2 ? 32 : 0);
+ dsector[19] = dsector[23] = 0; // Coding Info
+ }
+
+ if (smode != MODE_RAW) {
+ sector += 150;
+ yazedc_o.minute = cdutils::to_BCD(sector / 60 / 75);
+ yazedc_o.second = cdutils::to_BCD((sector / 75) % 60);
+ yazedc_o.frame = cdutils::to_BCD(sector % 75);
+ sector -= 150;
+ yazedc_o.do_encode_L2(dsector, smode, 0);
+ }
+
+ w->write(dsector, 2352);
+
+ sector++;
+
+ nsectors = MAX(nsectors, sector);
+ lastdispsect = MAX(lastdispsect, sector);
+
+ return rsector;
+}
+
+void isobuilder::setEOF() {
+ sub_EOF = 128;
+ sub_EOR = 1;
+}
+
+void isobuilder::clearEOF() {
+ sub_EOF = sub_EOR = 0;
+}
+
+isobuilder::DirTree * isobuilder::setbasics(PVD _pvd, int _rootsize, int _ptsize, int _nvd, int _rootsect) throw (GeneralException) {
+ if (basics) {
+ throw GeneralException("Basic ISO structures already set");
+ }
+ basics = true;
+
+ pvd = _pvd;
+ rootsize = _rootsize;
+ ptsize = _ptsize;
+ nvd = _nvd;
+
+ ptsect = 17 + nvd;
+ rootsect = ptsect + ptsize * 4;
+ if (_rootsect >= 0)
+ rootsect = _rootsect;
+ lastdispsect = rootsect + rootsize;
+
+ root = new DirTree(0);
+ root->name = ".";
+ root->creation = pvd.volcreat;
+ root->sector = rootsect;
+ root->size = rootsize * 2048;
+ return root;
+}
+
+isobuilder::DirTree * isobuilder::createdir(DirTree * p, const String & _name, int size, cdutils::DirEntry * d, int mode) throw (GeneralException) {
+ DirTree * r;
+
+ if (!p)
+ throw GeneralException("Empty father");
+
+ if (closed)
+ throw GeneralException("ISO is closed");
+
+ if (!basics)
+ throw GeneralException("ISO basis not created (no root!)");
+
+ r = new DirTree(p);
+
+ r->creation = p->creation;
+ if (d)
+ r->fromdir(d);
+ if (_name != "")
+ r->name = _name;
+ r->size = size * 2048;
+ if (!r->size)
+ r->size = d->Size;
+ r->sector = lastdispsect;
+ if (mode >= 0)
+ r->mode = mode;
+ else
+ r->mode = dmode;
+
+ lastdispsect += size;
+
+ return r;
+}
+
+isobuilder::DirTree * isobuilder::createfile(DirTree * p, Handle * file, const String & _name, cdutils::DirEntry * d, int mode) throw (GeneralException) {
+ DirTree * r;
+
+ if (!p)
+ throw GeneralException("Empty father");
+
+ if (closed)
+ throw GeneralException("ISO is closed");
+
+ if (!basics)
+ throw GeneralException("ISO basis not created (no root!)");
+
+ r = new DirTree(p, false);
+
+ r->name = _name;
+ r->creation = p->creation;
+ r->fromdir(d);
+ if (_name != "")
+ r->name = _name;
+ r->size = file->GetSize();
+ r->sector = putfile(file, mode);
+ if (mode >= 0)
+ r->mode = mode;
+ else
+ r->mode = dmode;
+
+ return r;
+}
+
+void isobuilder::copydir(isobuilder::DirTree * r, cdutils * cd, cdutils::DirEntry * d, int mode) {
+ Byte datas[2048];
+ cdutils::DirEntry * p;
+ int nsectors = d->Size / 2048, ssize, c = 0;
+ int fsize, osize;
+
+ if (mode < 0)
+ mode = dmode;
+
+ while (nsectors) {
+ cd->read_sector(datas, mode, d->Sector + c++);
+ nsectors--;
+ p = (cdutils::DirEntry *) datas;
+ ssize = 2048;
+ while ((ssize) && (p->R)) {
+ ssize -= p->R;
+ char pbuf[256];
+ memcpy(pbuf, p->id, p->N);
+ pbuf[p->N] = 0;
+ if (p->Flags & 2) {
+ if (!((p->N == 1) && ((p->id[0] == 0) || (p->id[0] == 1))))
+ copydir(createdir(r, "", p->Size / 2048, p, mode), cd, p, mode);
+ } else {
+ printm(M_INFO, "Dupping %s\n", pbuf);
+ int fmode;
+ osize = fsize = p->Size;
+ if (mode == MODE1) {
+ fmode = mode;
+ } else {
+ fmode = MODE2_FORM1;
+ int s, pad;
+ s = 33 + p->N;
+ if (s & 1) {
+ s++;
+ pad = 1;
+ } else {
+ pad = 0;
+ }
+ if ((s != p->R) && ((s + 14) == p->R)) {
+ if (!(p->id[p->N + pad + 4] & 8)) {
+ fmode = MODE2;
+ fsize = (p->Size / 2048) * 2336;
+ }
+ }
+ }
+ p->Size = fsize;
+ cdfile * tmp = new cdfile(cd, p, fmode);
+ createfile(r, tmp, "", p, fmode)->size = osize;
+ delete tmp;
+ p->Size = osize;
+ }
+ p = (cdutils::DirEntry *) (((Byte *) p) + p->R);
+ }
+ }
+}
+
+isobuilder::PVD isobuilder::createpvd(Handle * f) {
+ Byte datas[2048];
+ f->read(datas, 2048);
+ return createpvd(datas);
+}
+
+isobuilder::PVD isobuilder::createpvd(cdutils * cd) {
+ Byte datas[2048];
+ cd->read_sector(datas, GUESS, 16);
+ return createpvd(datas);
+}
+
+isobuilder::PVD isobuilder::createpvd(Byte * buffer) {
+ PVD r;
+ char pbuff[256];
+
+ memcpy(pbuff, buffer + 8, 32);
+ pbuff[32] = 0;
+ r.sysid = pbuff;
+ r.sysid.rtrim();
+ memcpy(pbuff, buffer + 40, 32);
+ pbuff[32] = 0;
+ r.volid = pbuff;
+ r.volid.rtrim();
+ memcpy(pbuff, buffer + 190, 128);
+ pbuff[128] = 0;
+ r.volsetid = pbuff;
+ r.volsetid.rtrim();
+ memcpy(pbuff, buffer + 318, 128);
+ pbuff[128] = 0;
+ r.pubid = pbuff;
+ r.pubid.rtrim();
+ memcpy(pbuff, buffer + 446, 128);
+ pbuff[128] = 0;
+ r.prepid = pbuff;
+ r.prepid.rtrim();
+ memcpy(pbuff, buffer + 574, 128);
+ pbuff[128] = 0;
+ r.appid = pbuff;
+ r.appid.rtrim();
+ memcpy(pbuff, buffer + 702, 37);
+ pbuff[37] = 0;
+ r.copyright = pbuff;
+ r.copyright.rtrim();
+ memcpy(pbuff, buffer + 739, 37);
+ pbuff[37] = 0;
+ r.abstract = pbuff;
+ r.abstract.rtrim();
+ memcpy(pbuff, buffer + 776, 37);
+ pbuff[37] = 0;
+ r.biblio = pbuff;
+ r.biblio.rtrim();
+
+ r.volcreat = Date(buffer + 813);
+ r.modif = Date(buffer + 830);
+ r.volexp = Date(buffer + 847);
+ r.voleff = Date(buffer + 864);
+
+ memcpy(r.appdata, buffer + 883, 512);
+
+ return r;
+}
+
+void isobuilder::close(Handle * cue, int mode, int nsects) throw (GeneralException) {
+ Byte datas[2048];
+ Byte * pdatas;
+ char * cdatas = (char *) datas;
+ int psize;
+
+ if (nsects < 0)
+ nsects = nsectors;
+
+ memset(datas, 0, 2048);
+
+ pdatas = (Byte *) malloc(ptsize * 2048);
+ psize = root->buildpath(pdatas, ptsize * 2048);
+ putdatas(pdatas, ptsize * 2048, mode, ptsect);
+ putdatas(pdatas, ptsize * 2048, mode, ptsect + ptsize);
+ root->buildpath(pdatas, ptsize * 2048, true);
+ putdatas(pdatas, ptsize * 2048, mode, ptsect + ptsize * 2);
+ putdatas(pdatas, ptsize * 2048, mode, ptsect + ptsize * 3);
+ free(pdatas);
+
+ datas[0] = 1;
+ datas[1] = 67;
+ datas[2] = 68;
+ datas[3] = 48;
+ datas[4] = 48;
+ datas[5] = 49;
+ datas[6] = 1;
+ datas[7] = 0;
+
+ sprintf(cdatas + 8, "%-32s", pvd.sysid.to_charp());
+ sprintf(cdatas + 40, "%-32s", pvd.volid.to_charp());
+ *((Uint32 *) (datas + 80)) = nsects;
+ *((Uint32 *) (datas + 84)) = cdutils::swap_dword(nsects);
+
+ datas[120] = 1;
+ datas[121] = 0;
+ datas[122] = 0;
+ datas[123] = 1;
+ datas[124] = 1;
+ datas[125] = 0;
+ datas[126] = 0;
+ datas[127] = 1;
+ datas[128] = 0;
+ datas[129] = 8;
+ datas[130] = 8;
+ datas[131] = 0;
+ *((Uint32 *) (datas + 132)) = psize;
+ *((Uint32 *) (datas + 136)) = cdutils::swap_dword(psize);
+ *((Uint32 *) (datas + 140)) = ptsect;
+ *((Uint32 *) (datas + 144)) = ptsect + ptsize;
+ *((Uint32 *) (datas + 148)) = cdutils::swap_dword(ptsect + ptsize * 2);
+ *((Uint32 *) (datas + 152)) = cdutils::swap_dword(ptsect + ptsize * 3);
+
+ root->buildentry(datas + 156, 34, false);
+
+ sprintf(cdatas + 190, "%-128s", pvd.volsetid.to_charp());
+ sprintf(cdatas + 318, "%-128s", pvd.pubid.to_charp());
+ sprintf(cdatas + 446, "%-128s", pvd.prepid.to_charp());
+ sprintf(cdatas + 574, "%-128s", pvd.appid.to_charp());
+ sprintf(cdatas + 702, "%-37s", pvd.copyright.to_charp());
+ sprintf(cdatas + 739, "%-37s", pvd.appid.to_charp());
+ sprintf(cdatas + 776, "%-37s", pvd.biblio.to_charp());
+
+ pvd.volcreat.dump(datas + 813);
+ pvd.modif.dump(datas + 830);
+ pvd.volexp.dump(datas + 847);
+ pvd.voleff.dump(datas + 864);
+
+ memcpy(datas + 883, pvd.appdata, 512);
+
+ clearEOF();
+ sub_EOR = 1;
+ createsector(datas, mode, 16);
+
+ memset(datas, 0, 2048);
+ datas[0] =255;
+ datas[1] = 67;
+ datas[2] = 68;
+ datas[3] = 48;
+ datas[4] = 48;
+ datas[5] = 49;
+ datas[6] = 1;
+
+ setEOF();
+ createsector(datas, mode);
+
+ root->dumpdirs(this);
+
+ closed = true;
+}