├── .gitignore ├── liberty.doc ├── liberty.pdf ├── src ├── help_de.c ├── help_es.c ├── help_fr.c ├── liberty_de.rcp ├── liberty_es.rcp ├── liberty_fr.rcp ├── binary │ ├── bgpal.bin │ ├── hlconv.bin │ ├── spr_pal0.bin │ └── spr_pal1.bin ├── hardware │ ├── GPDLib.h │ ├── SonyChars.h │ ├── HanderaChars.h │ ├── PalmChars.h │ ├── PalmHDD.h │ ├── HanderaVGA.h │ └── SonyHR.h ├── images │ ├── _paw1bpp.bmp │ ├── _paw2bpp.bmp │ ├── gbit1bpp.bmp │ ├── gbit2bpp.bmp │ ├── gcol2bpp.bmp │ ├── gray2bpp.bmp │ ├── help1bpp.bmp │ ├── hlp22bpp.bmp │ ├── icon1bpp.bmp │ ├── icon2bpp.bmp │ ├── icon8bpp.bmp │ ├── info1bpp.bmp │ ├── keys2bpp.bmp │ ├── palm1bpp.bmp │ ├── palm2bpp.bmp │ ├── sbut1bpp.bmp │ ├── smic1bpp.bmp │ ├── smic2bpp.bmp │ ├── smic8bpp.bmp │ ├── hlp12bpp_de.bmp │ ├── hlp12bpp_en.bmp │ ├── hlp12bpp_es.bmp │ └── hlp12bpp_fr.bmp ├── regcode │ ├── code0007.bin │ ├── @message │ ├── encrypt.c │ └── keygen.c ├── @message ├── header.h ├── help.h ├── liberty_de.def ├── liberty_en.def ├── liberty_es.def ├── liberty_fr.def ├── gccfix.h ├── gccfix.c ├── game.h ├── register.h ├── device.h ├── Makefile ├── palm.h ├── sound.inc ├── help_en.c ├── resource.h ├── register.c └── device.c ├── compiled ├── liberty_de.prc ├── liberty_en.prc ├── liberty_es.prc ├── liberty_fr.prc └── liberty_en_registered.prc ├── images ├── liberty-index.png └── liberty-screenshot.png ├── README.md ├── src_convertor ├── Makefile └── rom2pdb.c ├── LICENSE.txt ├── README.txt ├── CHANGES.txt └── FAQ.txt /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /liberty.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/liberty.doc -------------------------------------------------------------------------------- /liberty.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/liberty.pdf -------------------------------------------------------------------------------- /src/help_de.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/src/help_de.c -------------------------------------------------------------------------------- /src/help_es.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/src/help_es.c -------------------------------------------------------------------------------- /src/help_fr.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/src/help_fr.c -------------------------------------------------------------------------------- /src/liberty_de.rcp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/src/liberty_de.rcp -------------------------------------------------------------------------------- /src/liberty_es.rcp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/src/liberty_es.rcp -------------------------------------------------------------------------------- /src/liberty_fr.rcp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/src/liberty_fr.rcp -------------------------------------------------------------------------------- /src/binary/bgpal.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/src/binary/bgpal.bin -------------------------------------------------------------------------------- /compiled/liberty_de.prc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/compiled/liberty_de.prc -------------------------------------------------------------------------------- /compiled/liberty_en.prc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/compiled/liberty_en.prc -------------------------------------------------------------------------------- /compiled/liberty_es.prc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/compiled/liberty_es.prc -------------------------------------------------------------------------------- /compiled/liberty_fr.prc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/compiled/liberty_fr.prc -------------------------------------------------------------------------------- /src/binary/hlconv.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/src/binary/hlconv.bin -------------------------------------------------------------------------------- /src/binary/spr_pal0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/src/binary/spr_pal0.bin -------------------------------------------------------------------------------- /src/binary/spr_pal1.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/src/binary/spr_pal1.bin -------------------------------------------------------------------------------- /src/hardware/GPDLib.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/src/hardware/GPDLib.h -------------------------------------------------------------------------------- /src/images/_paw1bpp.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/src/images/_paw1bpp.bmp -------------------------------------------------------------------------------- /src/images/_paw2bpp.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/src/images/_paw2bpp.bmp -------------------------------------------------------------------------------- /src/images/gbit1bpp.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/src/images/gbit1bpp.bmp -------------------------------------------------------------------------------- /src/images/gbit2bpp.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/src/images/gbit2bpp.bmp -------------------------------------------------------------------------------- /src/images/gcol2bpp.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/src/images/gcol2bpp.bmp -------------------------------------------------------------------------------- /src/images/gray2bpp.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/src/images/gray2bpp.bmp -------------------------------------------------------------------------------- /src/images/help1bpp.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/src/images/help1bpp.bmp -------------------------------------------------------------------------------- /src/images/hlp22bpp.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/src/images/hlp22bpp.bmp -------------------------------------------------------------------------------- /src/images/icon1bpp.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/src/images/icon1bpp.bmp -------------------------------------------------------------------------------- /src/images/icon2bpp.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/src/images/icon2bpp.bmp -------------------------------------------------------------------------------- /src/images/icon8bpp.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/src/images/icon8bpp.bmp -------------------------------------------------------------------------------- /src/images/info1bpp.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/src/images/info1bpp.bmp -------------------------------------------------------------------------------- /src/images/keys2bpp.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/src/images/keys2bpp.bmp -------------------------------------------------------------------------------- /src/images/palm1bpp.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/src/images/palm1bpp.bmp -------------------------------------------------------------------------------- /src/images/palm2bpp.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/src/images/palm2bpp.bmp -------------------------------------------------------------------------------- /src/images/sbut1bpp.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/src/images/sbut1bpp.bmp -------------------------------------------------------------------------------- /src/images/smic1bpp.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/src/images/smic1bpp.bmp -------------------------------------------------------------------------------- /src/images/smic2bpp.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/src/images/smic2bpp.bmp -------------------------------------------------------------------------------- /src/images/smic8bpp.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/src/images/smic8bpp.bmp -------------------------------------------------------------------------------- /images/liberty-index.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/images/liberty-index.png -------------------------------------------------------------------------------- /src/regcode/code0007.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/src/regcode/code0007.bin -------------------------------------------------------------------------------- /src/images/hlp12bpp_de.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/src/images/hlp12bpp_de.bmp -------------------------------------------------------------------------------- /src/images/hlp12bpp_en.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/src/images/hlp12bpp_en.bmp -------------------------------------------------------------------------------- /src/images/hlp12bpp_es.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/src/images/hlp12bpp_es.bmp -------------------------------------------------------------------------------- /src/images/hlp12bpp_fr.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/src/images/hlp12bpp_fr.bmp -------------------------------------------------------------------------------- /images/liberty-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/images/liberty-screenshot.png -------------------------------------------------------------------------------- /compiled/liberty_en_registered.prc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ardiri/palmos-liberty/HEAD/compiled/liberty_en_registered.prc -------------------------------------------------------------------------------- /src/@message: -------------------------------------------------------------------------------- 1 | Liberty - GameBoy Emulator 2 | -------------------------- 3 | (c) Gambit Studios, 2000 4 | 5 | This Software is protected under international copyright regulations. 6 | If you can see this message, you are in violation of section 3 of the 7 | end user license agreement (EULA) distributed with the Software. 8 | -------------------------------------------------------------------------------- /src/regcode/@message: -------------------------------------------------------------------------------- 1 | Liberty - GameBoy Emulator 2 | -------------------------- 3 | (c) Gambit Studios, 2000 4 | 5 | This Software is protected under international copyright regulations. 6 | If you can see this message, you are in violation of section 3 of the 7 | end user license agreement (EULA) distributed with the Software. 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # palmos-liberty 2 | 3 | ---------------------------------------------------------------------------- 4 | 5 | SOURCE CODE PROVIDED AS-IS FOR EDUCATIONAL PURPOSES 6 | 7 | ---------------------------------------------------------------------------- 8 | 9 | ![liberty info](images/liberty-index.png) 10 | 11 | # screenshots 12 | 13 | ![liberty info](images/liberty-screenshot.png) 14 | -------------------------------------------------------------------------------- /src/hardware/SonyChars.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (c) 1999-2000 Sony Corporation. 4 | * All rights reserved. 5 | * 6 | * File: SonyChars.h 7 | * 8 | * Description: 9 | * This file defines the Sony characters in fonts. 10 | * 11 | * History: 12 | * 13 | *****************************************************************************/ 14 | 15 | #ifndef __SONYCHARS_H__ 16 | #define __SONYCHARS_H__ 17 | 18 | #define vchrSonyMin 0x1700 19 | #define vchrSonyMax 0x170F // 16 command keys 20 | 21 | #define vchrJogUp 0x1700 22 | #define vchrJogDown 0x1701 23 | #define vchrJogPressRepeat 0x1702 24 | #define vchrJogPageUp 0x1703 25 | #define vchrJogPageDown 0x1704 26 | #define vchrJogPress 0x1705 27 | #define vchrJogRelease 0x1706 28 | 29 | #endif // __SONYCHARS_H__ 30 | 31 | -------------------------------------------------------------------------------- /src_convertor/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # @(#)Makefile 3 | # 4 | # Copyright 2000, Aaron Ardiri (mailto:aaron@ardiri.com) 5 | # Michael Ethetton (mailto:methetton@gambitstudios.com) 6 | # All rights reserved. 7 | # 8 | # This file was generated as part of the "rom2pdb" program that generates 9 | # PDB data files for the "liberty" program developed for the Palm Computing 10 | # Platform designed by Palm: http://www.palm.com/ 11 | # 12 | # The contents of this file is confidential and proprietrary in nature 13 | # ("Confidential Information"). Redistribution or modification without 14 | # prior consent of the original author(s) is prohibited. 15 | # 16 | # REVISIONS: 17 | # ---------- 18 | # 19 | # 13-Jul-2000 Aaron Ardiri Creation 20 | # 21 | 22 | # compiler commands 23 | PREFIX = 24 | CC = $(PREFIX)gcc 25 | 26 | # source / outputs 27 | SRCS = rom2pdb.c 28 | EXEC = rom2pdb 29 | 30 | # compiler flags 31 | CCFLAGS = -Wall 32 | 33 | # compile requirements 34 | all: 35 | $(CC) $(CCFLAGS) -o $(EXEC) $(SRCS) 36 | 37 | # clean-up funtions 38 | clean: 39 | rm -f *.[oa] *~ 40 | 41 | distclean: 42 | rm -f *.[oa] *~ $(EXEC) 43 | -------------------------------------------------------------------------------- /src/header.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @(#)header.h 3 | * 4 | * Copyright 2000-2002, Aaron Ardiri (mailto:aaron@ardiri.com) 5 | * Michael Ethetton (mailto:methetton@gambitstudios.com) 6 | * All rights reserved. 7 | * 8 | * This file was generated as part of the "liberty" program developed for 9 | * the Palm Computing Platform designed by Palm: http://www.palm.com/ 10 | * 11 | * The contents of this file is confidential and proprietrary in nature 12 | * ("Confidential Information"). Redistribution or modification without 13 | * prior consent of the original author(s) is prohibited. 14 | * 15 | * NOTE: 16 | * The following portions of code found within this source code file are 17 | * owned exclusively by Michael Ethetton, and shall not be used in or 18 | * sold to other projects (internal or external) without the written 19 | * permission of Michael Ethetton. 20 | * 21 | * - z-80 CPU Emulation 22 | * - Nintendo Gameboy Emulation System 23 | * 24 | * The following portions of code found within this source code file are 25 | * owned exclusively by Aaron Ardiri, and shall not be used in or 26 | * sold to other projects (internal or external) without the written 27 | * permission of Aaron Ardiri. 28 | * 29 | * - GNU prc-tools 2.0 application framework 30 | * - Help System 31 | * - Device Configuration Module 32 | * - Multiple Code Segments Solution 33 | * 34 | * It shall be noted that Aaron Ardiri has licensed the above source code 35 | * and framework to Michael Ethetton for use only in the "liberty" project. 36 | */ 37 | -------------------------------------------------------------------------------- /src/help.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @(#)help.h 3 | * 4 | * Copyright 2000-2002, Aaron Ardiri (mailto:aaron@ardiri.com) 5 | * Michael Ethetton (mailto:methetton@gambitstudios.com) 6 | * All rights reserved. 7 | * 8 | * This file was generated as part of the "liberty" program developed for 9 | * the Palm Computing Platform designed by Palm: http://www.palm.com/ 10 | * 11 | * The contents of this file is confidential and proprietrary in nature 12 | * ("Confidential Information"). Redistribution or modification without 13 | * prior consent of the original author(s) is prohibited. 14 | * 15 | * NOTE: 16 | * The following portions of code found within this source code file are 17 | * owned exclusively by Michael Ethetton, and shall not be used in or 18 | * sold to other projects (internal or external) without the written 19 | * permission of Michael Ethetton. 20 | * 21 | * - z-80 CPU Emulation 22 | * - Nintendo Gameboy Emulation System 23 | * 24 | * The following portions of code found within this source code file are 25 | * owned exclusively by Aaron Ardiri, and shall not be used in or 26 | * sold to other projects (internal or external) without the written 27 | * permission of Aaron Ardiri. 28 | * 29 | * - GNU prc-tools 2.0 application framework 30 | * - Help System 31 | * - Device Configuration Module 32 | * - Multiple Code Segments Solution 33 | * 34 | * It shall be noted that Aaron Ardiri has licensed the above source code 35 | * and framework to Michael Ethetton for use only in the "liberty" project. 36 | */ 37 | 38 | #ifndef _HELP_H 39 | #define _HELP_H 40 | 41 | #include "palm.h" 42 | 43 | extern UInt16 InitInstructions() __HELP__; 44 | extern void DrawInstructions(UInt16) __HELP__; 45 | extern void QuitInstructions() __HELP__; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/liberty_de.def: -------------------------------------------------------------------------------- 1 | /* 2 | * @(#)liberty_de.def 3 | * 4 | * Copyright 2000-2002, Aaron Ardiri (mailto:aaron@ardiri.com) 5 | * Michael Ethetton (mailto:methetton@gambitstudios.com) 6 | * All rights reserved. 7 | * 8 | * This file was generated as part of the "liberty" program developed for 9 | * the Palm Computing Platform designed by Palm: http://www.palm.com/ 10 | * 11 | * The contents of this file is confidential and proprietrary in nature 12 | * ("Confidential Information"). Redistribution or modification without 13 | * prior consent of the original author(s) is prohibited. 14 | * 15 | * NOTE: 16 | * The following portions of code found within this source code file are 17 | * owned exclusively by Michael Ethetton, and shall not be used in or 18 | * sold to other projects (internal or external) without the written 19 | * permission of Michael Ethetton. 20 | * 21 | * - z-80 CPU Emulation 22 | * - Nintendo Gameboy Emulation System 23 | * 24 | * The following portions of code found within this source code file are 25 | * owned exclusively by Aaron Ardiri, and shall not be used in or 26 | * sold to other projects (internal or external) without the written 27 | * permission of Aaron Ardiri. 28 | * 29 | * - GNU prc-tools 2.0 application framework 30 | * - Help System 31 | * - Device Configuration Module 32 | * - Multiple Code Segments Solution 33 | * 34 | * It shall be noted that Aaron Ardiri has licensed the above source code 35 | * and framework to Michael Ethetton for use only in the "liberty" project. 36 | * 37 | * ------------------------------------------------------------------------ 38 | * THIS FILE CONTAINS THE GERMAN LANGUAGE TEXT 39 | * ------------------------------------------------------------------------ 40 | */ 41 | 42 | application { "Liberty" Gmbt stack=4096 } 43 | multiple code { "register" "device" "game" "help" "safe0001" "safe0002" } 44 | -------------------------------------------------------------------------------- /src/liberty_en.def: -------------------------------------------------------------------------------- 1 | /* 2 | * @(#)liberty_en.def 3 | * 4 | * Copyright 2000-2002, Aaron Ardiri (mailto:aaron@ardiri.com) 5 | * Michael Ethetton (mailto:methetton@gambitstudios.com) 6 | * All rights reserved. 7 | * 8 | * This file was generated as part of the "liberty" program developed for 9 | * the Palm Computing Platform designed by Palm: http://www.palm.com/ 10 | * 11 | * The contents of this file is confidential and proprietrary in nature 12 | * ("Confidential Information"). Redistribution or modification without 13 | * prior consent of the original author(s) is prohibited. 14 | * 15 | * NOTE: 16 | * The following portions of code found within this source code file are 17 | * owned exclusively by Michael Ethetton, and shall not be used in or 18 | * sold to other projects (internal or external) without the written 19 | * permission of Michael Ethetton. 20 | * 21 | * - z-80 CPU Emulation 22 | * - Nintendo Gameboy Emulation System 23 | * 24 | * The following portions of code found within this source code file are 25 | * owned exclusively by Aaron Ardiri, and shall not be used in or 26 | * sold to other projects (internal or external) without the written 27 | * permission of Aaron Ardiri. 28 | * 29 | * - GNU prc-tools 2.0 application framework 30 | * - Help System 31 | * - Device Configuration Module 32 | * - Multiple Code Segments Solution 33 | * 34 | * It shall be noted that Aaron Ardiri has licensed the above source code 35 | * and framework to Michael Ethetton for use only in the "liberty" project. 36 | * 37 | * ------------------------------------------------------------------------ 38 | * THIS FILE CONTAINS THE ENGLISH LANGUAGE TEXT 39 | * ------------------------------------------------------------------------ 40 | */ 41 | 42 | application { "Liberty" Gmbt stack=4096 } 43 | multiple code { "register" "device" "game" "help" "safe0001" "safe0002" } 44 | -------------------------------------------------------------------------------- /src/liberty_es.def: -------------------------------------------------------------------------------- 1 | /* 2 | * @(#)liberty_en.def 3 | * 4 | * Copyright 2000-2002, Aaron Ardiri (mailto:aaron@ardiri.com) 5 | * Michael Ethetton (mailto:methetton@gambitstudios.com) 6 | * All rights reserved. 7 | * 8 | * This file was generated as part of the "liberty" program developed for 9 | * the Palm Computing Platform designed by Palm: http://www.palm.com/ 10 | * 11 | * The contents of this file is confidential and proprietrary in nature 12 | * ("Confidential Information"). Redistribution or modification without 13 | * prior consent of the original author(s) is prohibited. 14 | * 15 | * NOTE: 16 | * The following portions of code found within this source code file are 17 | * owned exclusively by Michael Ethetton, and shall not be used in or 18 | * sold to other projects (internal or external) without the written 19 | * permission of Michael Ethetton. 20 | * 21 | * - z-80 CPU Emulation 22 | * - Nintendo Gameboy Emulation System 23 | * 24 | * The following portions of code found within this source code file are 25 | * owned exclusively by Aaron Ardiri, and shall not be used in or 26 | * sold to other projects (internal or external) without the written 27 | * permission of Aaron Ardiri. 28 | * 29 | * - GNU prc-tools 2.0 application framework 30 | * - Help System 31 | * - Device Configuration Module 32 | * - Multiple Code Segments Solution 33 | * 34 | * It shall be noted that Aaron Ardiri has licensed the above source code 35 | * and framework to Michael Ethetton for use only in the "liberty" project. 36 | * 37 | * ------------------------------------------------------------------------ 38 | * THIS FILE CONTAINS THE SPANISH LANGUAGE TEXT 39 | * ------------------------------------------------------------------------ 40 | */ 41 | 42 | application { "Liberty" Gmbt stack=4096 } 43 | multiple code { "register" "device" "game" "help" "safe0001" "safe0002" } 44 | -------------------------------------------------------------------------------- /src/liberty_fr.def: -------------------------------------------------------------------------------- 1 | /* 2 | * @(#)liberty_fr.def 3 | * 4 | * Copyright 2000-2002, Aaron Ardiri (mailto:aaron@ardiri.com) 5 | * Michael Ethetton (mailto:methetton@gambitstudios.com) 6 | * All rights reserved. 7 | * 8 | * This file was generated as part of the "liberty" program developed for 9 | * the Palm Computing Platform designed by Palm: http://www.palm.com/ 10 | * 11 | * The contents of this file is confidential and proprietrary in nature 12 | * ("Confidential Information"). Redistribution or modification without 13 | * prior consent of the original author(s) is prohibited. 14 | * 15 | * NOTE: 16 | * The following portions of code found within this source code file are 17 | * owned exclusively by Michael Ethetton, and shall not be used in or 18 | * sold to other projects (internal or external) without the written 19 | * permission of Michael Ethetton. 20 | * 21 | * - z-80 CPU Emulation 22 | * - Nintendo Gameboy Emulation System 23 | * 24 | * The following portions of code found within this source code file are 25 | * owned exclusively by Aaron Ardiri, and shall not be used in or 26 | * sold to other projects (internal or external) without the written 27 | * permission of Aaron Ardiri. 28 | * 29 | * - GNU prc-tools 2.0 application framework 30 | * - Help System 31 | * - Device Configuration Module 32 | * - Multiple Code Segments Solution 33 | * 34 | * It shall be noted that Aaron Ardiri has licensed the above source code 35 | * and framework to Michael Ethetton for use only in the "liberty" project. 36 | * 37 | * ------------------------------------------------------------------------ 38 | * THIS FILE CONTAINS THE FRENCH LANGUAGE TEXT 39 | * ------------------------------------------------------------------------ 40 | */ 41 | 42 | application { "Liberty" Gmbt stack=4096 } 43 | multiple code { "register" "device" "game" "help" "safe0001" "safe0002" } 44 | -------------------------------------------------------------------------------- /src/gccfix.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @(#)gccfix.h 3 | * 4 | * Copyright 2000-2002, Aaron Ardiri (mailto:aaron@ardiri.com) 5 | * Michael Ethetton (mailto:methetton@gambitstudios.com) 6 | * All rights reserved. 7 | * 8 | * This file was generated as part of the "liberty" program developed for 9 | * the Palm Computing Platform designed by Palm: http://www.palm.com/ 10 | * 11 | * The contents of this file is confidential and proprietrary in nature 12 | * ("Confidential Information"). Redistribution or modification without 13 | * prior consent of the original author(s) is prohibited. 14 | * 15 | * NOTE: 16 | * The following portions of code found within this source code file are 17 | * owned exclusively by Michael Ethetton, and shall not be used in or 18 | * sold to other projects (internal or external) without the written 19 | * permission of Michael Ethetton. 20 | * 21 | * - z-80 CPU Emulation 22 | * - Nintendo Gameboy Emulation System 23 | * 24 | * The following portions of code found within this source code file are 25 | * owned exclusively by Aaron Ardiri, and shall not be used in or 26 | * sold to other projects (internal or external) without the written 27 | * permission of Aaron Ardiri. 28 | * 29 | * - GNU prc-tools 2.0 application framework 30 | * - Help System 31 | * - Device Configuration Module 32 | * - Multiple Code Segments Solution 33 | * 34 | * It shall be noted that Aaron Ardiri has licensed the above source code 35 | * and framework to Michael Ethetton for use only in the "liberty" project. 36 | * 37 | * - source code obtained from John Marshall (john_w_marshall@palm.com) 38 | */ 39 | 40 | #ifndef _GCCFIX_H 41 | #define _GCCFIX_H 42 | 43 | #define UNUSED __attribute__ ((unused)) 44 | 45 | extern void *__text__; 46 | extern long data_start; 47 | extern UInt32 *start(); 48 | extern void _RelocateChain(UInt16, void *); 49 | extern void _GccLoadCodeAndRelocateData(void); 50 | extern void _GccReleaseCode(UInt16, void *, UInt16); 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/gccfix.c: -------------------------------------------------------------------------------- 1 | /* 2 | * @(#)gccfix.c 3 | * 4 | * Copyright 2000-2002, Aaron Ardiri (mailto:aaron@ardiri.com) 5 | * Michael Ethetton (mailto:methetton@gambitstudios.com) 6 | * All rights reserved. 7 | * 8 | * This file was generated as part of the "liberty" program developed for 9 | * the Palm Computing Platform designed by Palm: http://www.palm.com/ 10 | * 11 | * The contents of this file is confidential and proprietrary in nature 12 | * ("Confidential Information"). Redistribution or modification without 13 | * prior consent of the original author(s) is prohibited. 14 | * 15 | * NOTE: 16 | * The following portions of code found within this source code file are 17 | * owned exclusively by Michael Ethetton, and shall not be used in or 18 | * sold to other projects (internal or external) without the written 19 | * permission of Michael Ethetton. 20 | * 21 | * - z-80 CPU Emulation 22 | * - Nintendo Gameboy Emulation System 23 | * 24 | * The following portions of code found within this source code file are 25 | * owned exclusively by Aaron Ardiri, and shall not be used in or 26 | * sold to other projects (internal or external) without the written 27 | * permission of Aaron Ardiri. 28 | * 29 | * - GNU prc-tools 2.0 application framework 30 | * - Help System 31 | * - Device Configuration Module 32 | * - Multiple Code Segments Solution 33 | * 34 | * It shall be noted that Aaron Ardiri has licensed the above source code 35 | * and framework to Michael Ethetton for use only in the "liberty" project. 36 | * 37 | * - source code obtained from John Marshall (john_w_marshall@palm.com) 38 | */ 39 | 40 | #include "palm.h" 41 | 42 | void 43 | _GccReleaseCode(UInt16 cmd UNUSED, void *pbp UNUSED, UInt16 flags) 44 | { 45 | if (flags & sysAppLaunchFlagNewGlobals) { 46 | 47 | MemHandle codeH; 48 | Int32 resno; 49 | 50 | for (resno = 2; (codeH = DmGet1Resource('code', resno)) != NULL; resno++) { 51 | MemHandleUnlock(codeH); 52 | DmReleaseResource(codeH); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/hardware/HanderaChars.h: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | * 3 | * Copyright (c) 2001 TRG, All Rights Reserved 4 | * 5 | * FileName: 6 | * TRGChars.h 7 | * 8 | * Description: 9 | * Extra character and keyboard bitmap definitions used 10 | * on TRG devices. 11 | * 12 | * History: 13 | * 11-21-00 -- original version 14 | * 15 | ********************************************************************/ 16 | #ifndef __TRG_CHARS_H__ 17 | #define __TRG_CHARS_H__ 18 | 19 | #define TRGKeyFtrNum 20 20 | 21 | // this feature provides a bitmap of the extra keys that are available 22 | // on this unit that may be returned from KeyCurrentState() 23 | #define _TRGKeyFeaturePresent(keymapPtr) \ 24 | (Boolean)(FtrGet(TRGSysFtrID, TRGKeyFtrNum, keymapPtr) == 0) 25 | 26 | /*------------------------------------------------------------------- 27 | * Additional definition of bit field returned from KeyCurrentState, 28 | * see KeyMgr.h 29 | *------------------------------------------------------------------*/ 30 | #define keyBitJogUp 0x1000 31 | #define keyBitJogDown 0x2000 32 | #define keyBitJogPush 0x4000 33 | #define keyBitAux 0x8000 34 | 35 | /*------------------------------------------------------------------- 36 | * Additional character definitions corresponding to additional hard 37 | * buttons on StarKist. See Chars.h 38 | *------------------------------------------------------------------*/ 39 | #define vchrTrgJogUp (vchrCFlashMin + 4) 40 | #define vchrTrgJogDown (vchrCFlashMin + 5) 41 | #define vchrTrgJogPush (vchrCFlashMin + 6) 42 | #define vchrTrgAux (vchrCFlashMin + 7) 43 | 44 | /*------------------------------------------------------------------- 45 | * Additional virtual characters for extra silk buttons on StarKist 46 | * See Chars.h 47 | *------------------------------------------------------------------*/ 48 | #define vchrTRGVolume (vchrCFlashMin + 3) 49 | #define vchrSilkToggle (vchrCFlashMin + 10) 50 | 51 | 52 | #endif // #ifndef __TRG_CHARS_H__ 53 | 54 | -------------------------------------------------------------------------------- /src/game.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @(#)game.h 3 | * 4 | * Copyright 2000-2002, Aaron Ardiri (mailto:aaron@ardiri.com) 5 | * Michael Ethetton (mailto:methetton@gambitstudios.com) 6 | * All rights reserved. 7 | * 8 | * This file was generated as part of the "liberty" program developed for 9 | * the Palm Computing Platform designed by Palm: http://www.palm.com/ 10 | * 11 | * The contents of this file is confidential and proprietrary in nature 12 | * ("Confidential Information"). Redistribution or modification without 13 | * prior consent of the original author(s) is prohibited. 14 | * 15 | * NOTE: 16 | * The following portions of code found within this source code file are 17 | * owned exclusively by Michael Ethetton, and shall not be used in or 18 | * sold to other projects (internal or external) without the written 19 | * permission of Michael Ethetton. 20 | * 21 | * - z-80 CPU Emulation 22 | * - Nintendo Gameboy Emulation System 23 | * 24 | * The following portions of code found within this source code file are 25 | * owned exclusively by Aaron Ardiri, and shall not be used in or 26 | * sold to other projects (internal or external) without the written 27 | * permission of Aaron Ardiri. 28 | * 29 | * - GNU prc-tools 2.0 application framework 30 | * - Help System 31 | * - Device Configuration Module 32 | * - Multiple Code Segments Solution 33 | * 34 | * It shall be noted that Aaron Ardiri has licensed the above source code 35 | * and framework to Michael Ethetton for use only in the "liberty" project. 36 | */ 37 | 38 | #ifndef _GAME_H 39 | #define _GAME_H 40 | 41 | #include "palm.h" 42 | 43 | extern UInt16 GameInitialize(PreferencesType *) __GAME__; 44 | extern void GameReset() __GAME__; 45 | extern void GameSave(PreferencesType *) __GAME__; 46 | extern void GameRestore(PreferencesType *) __GAME__; 47 | extern void GameEmulation(PreferencesType *, ConfigType *, UInt32) __GAME__; 48 | extern void GameTerminate(PreferencesType *) __GAME__; 49 | extern void EmulateFrame() __GAME__; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | ---------------------------------------------------------------------------- 2 | Liberty version 1.3.1 3 | ---------------------------------------------------------------------------- 4 | 5 | Gambit Studios 6 | Electronic End User License Agreement 7 | Liberty version 1.3.1 8 | 9 | This Gambit Studios ("GS") End User License Agreement accompanies the 10 | Liberty product ("Software"). Read this agreement very carefully. If 11 | you do not wish to accept this agreement, you may not install or use 12 | this Software on a device, simulator or emulator of the Palm Computing 13 | Platform. 14 | 15 | 1. Use of Software 16 | You may install the Software on a device, simulator or emulator of the 17 | Palm Computing Platform and distribute unmodified copies of the Software 18 | freely excluding the registration key in any form, modified or not. Each 19 | copy that is distributed must contain this agreement and any other 20 | documentation pertaining to this Software. You may not offer versions of 21 | this Software for download or other means of distribution without the 22 | prior consent of GS. You may not charge a fee for the distribution 23 | of this Software on any media with the exception of the cost of the 24 | media that it is supplied on or with. In the case where the medium is 25 | physical, on production, a complimentary copy of the media shall be 26 | supplied to GS free of charge. 27 | 28 | Gambit Studios may be contacted by email at: support@gambitstudios.com 29 | 30 | 2. Copyright 31 | The Software is owned by GS. Its structure, presentation and source code 32 | are valuable trade secrets of GS. This agreement does not grant you 33 | intellectual property rights in the Software. 34 | 35 | 3. Restrictions 36 | You agree not to modify, adapt, translate, reverse engineer, decompile, 37 | dissasemble or otherwise attempt to discover the code and algorithms of 38 | the Software. 39 | 40 | 4. No Warranty 41 | THE SOFTWARE IS DELIVERED AS IS AND GS MAKES NO WARRANTY AS TO ITS USE 42 | OR PERFORMANCE. GS DOES NOT, AND CANNOT WARRANT THE PERFORMANCE OR 43 | RESULTS YOU MAY OBTAIN BY USING THE SOFTWARE OR ITS DOCUMENTATION. GS 44 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AS TO NONINFRINGEMENT OF THIRD 45 | PARTY RIGHTS, MERCHANTABILITY, OR FITNESS FOR ANY PARTICULAR PURPOSE. IN 46 | NO EVENT WILL GS BE LIABLE TO YOU FOR ANY CONSEQUENTIAL, INCIDENTAL OR 47 | SPECIAL DAMAGES, OR FOR ANY CLAIM BY ANY THIRD PARTY. 48 | 49 | ---------------------------------------------------------------------------- 50 | -------------------------------------------------------------------------------- /src/register.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @(#)register.h 3 | * 4 | * Copyright 2000-2002, Aaron Ardiri (mailto:aaron@ardiri.com) 5 | * Michael Ethetton (mailto:methetton@gambitstudios.com) 6 | * All rights reserved. 7 | * 8 | * This file was generated as part of the "liberty" program developed for 9 | * the Palm Computing Platform designed by Palm: http://www.palm.com/ 10 | * 11 | * The contents of this file is confidential and proprietrary in nature 12 | * ("Confidential Information"). Redistribution or modification without 13 | * prior consent of the original author(s) is prohibited. 14 | * 15 | * NOTE: 16 | * The following portions of code found within this source code file are 17 | * owned exclusively by Michael Ethetton, and shall not be used in or 18 | * sold to other projects (internal or external) without the written 19 | * permission of Michael Ethetton. 20 | * 21 | * - z-80 CPU Emulation 22 | * - Nintendo Gameboy Emulation System 23 | * 24 | * The following portions of code found within this source code file are 25 | * owned exclusively by Aaron Ardiri, and shall not be used in or 26 | * sold to other projects (internal or external) without the written 27 | * permission of Aaron Ardiri. 28 | * 29 | * - GNU prc-tools 2.0 application framework 30 | * - Help System 31 | * - Device Configuration Module 32 | * - Multiple Code Segments Solution 33 | * 34 | * It shall be noted that Aaron Ardiri has licensed the above source code 35 | * and framework to Michael Ethetton for use only in the "liberty" project. 36 | */ 37 | 38 | #ifndef _REGISTER_H 39 | #define _REGISTER_H 40 | 41 | #include "palm.h" 42 | 43 | #define MAX_IDLENGTH 8 44 | 45 | enum gameAdjustMode 46 | { 47 | gameLoadROM = 0, 48 | gameFreeROM 49 | }; 50 | 51 | typedef struct 52 | { 53 | UInt8 adjustMode; // what type of adjustment? 54 | union { 55 | 56 | // generic 57 | struct { 58 | UInt8 unused[16]; 59 | } generic; 60 | 61 | // load ROM 62 | struct { 63 | UInt16 pageCount; 64 | UInt8 **ptrPages; 65 | } loadROM; 66 | 67 | // free ROM 68 | struct { 69 | UInt16 pageCount; 70 | UInt8 **ptrPages; 71 | } freeROM; 72 | 73 | } data; 74 | } GameAdjustmentType; 75 | 76 | extern void RegisterInitialize(PreferencesType *) __REGISTER__; 77 | extern void RegisterShowMessage(PreferencesType *) __REGISTER__; 78 | extern Boolean RegisterAdjustGame(PreferencesType *, 79 | GameAdjustmentType *) __REGISTER__; 80 | extern UInt8 RegisterChecksum(UInt8*, UInt16); 81 | extern void RegisterDecryptChunk(UInt8*, Int16, Int16, UInt8); 82 | extern void RegisterTerminate() __REGISTER__; 83 | 84 | extern void _regiLoader(PreferencesType *) __SAFE0001__; 85 | extern Boolean _adjustGame(PreferencesType *, 86 | GameAdjustmentType *) __SAFE0002__; 87 | 88 | #endif 89 | -------------------------------------------------------------------------------- /src/device.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @(#)device.h 3 | * 4 | * Copyright 2000-2002, Aaron Ardiri (mailto:aaron@ardiri.com) 5 | * Michael Ethetton (mailto:methetton@gambitstudios.com) 6 | * All rights reserved. 7 | * 8 | * This file was generated as part of the "liberty" program developed for 9 | * the Palm Computing Platform designed by Palm: http://www.palm.com/ 10 | * 11 | * The contents of this file is confidential and proprietrary in nature 12 | * ("Confidential Information"). Redistribution or modification without 13 | * prior consent of the original author(s) is prohibited. 14 | * 15 | * NOTE: 16 | * The following portions of code found within this source code file are 17 | * owned exclusively by Michael Ethetton, and shall not be used in or 18 | * sold to other projects (internal or external) without the written 19 | * permission of Michael Ethetton. 20 | * 21 | * - z-80 CPU Emulation 22 | * - Nintendo Gameboy Emulation System 23 | * 24 | * The following portions of code found within this source code file are 25 | * owned exclusively by Aaron Ardiri, and shall not be used in or 26 | * sold to other projects (internal or external) without the written 27 | * permission of Aaron Ardiri. 28 | * 29 | * - GNU prc-tools 2.0 application framework 30 | * - Help System 31 | * - Device Configuration Module 32 | * - Multiple Code Segments Solution 33 | * 34 | * It shall be noted that Aaron Ardiri has licensed the above source code 35 | * and framework to Michael Ethetton for use only in the "liberty" project. 36 | */ 37 | 38 | #ifndef _DEVICE_H 39 | #define _DEVICE_H 40 | 41 | #include "palm.h" 42 | 43 | #define romVersion1 sysMakeROMVersion(1,0,0,sysROMStageDevelopment,0) 44 | #define romVersion2 sysMakeROMVersion(2,0,0,sysROMStageDevelopment,0) 45 | #define romVersion3 sysMakeROMVersion(3,0,0,sysROMStageDevelopment,0) 46 | #define romVersion3_1 sysMakeROMVersion(3,1,0,sysROMStageDevelopment,0) 47 | #define romVersion3_2 sysMakeROMVersion(3,2,0,sysROMStageDevelopment,0) 48 | #define romVersion3_5 sysMakeROMVersion(3,5,0,sysROMStageDevelopment,0) 49 | #define romVersion4 sysMakeROMVersion(4,0,0,sysROMStageDevelopment,0) 50 | #define romVersion5 sysMakeROMVersion(5,0,0,sysROMStageDevelopment,0) 51 | 52 | #define sysFtrNumProcessorVZ 0x00030000 53 | #define sysFtrNumProcessorSuperVZ 0x00040000 54 | 55 | enum 56 | { 57 | palReset = 0, 58 | palGet, 59 | palSet 60 | }; 61 | 62 | enum 63 | { 64 | graySet = 0, 65 | grayGet 66 | }; 67 | 68 | extern Boolean DeviceCheckCompatability() __DEVICE__; 69 | extern void DeviceInitialize() __DEVICE__; 70 | extern Boolean DeviceSupportsGrayscale() __DEVICE__; 71 | extern void DeviceGrayscale(UInt16, UInt8 *, UInt8 *) __DEVICE__; 72 | extern Boolean DeviceSupportsGrayPalette() __DEVICE__; 73 | extern void DeviceGrayPalette(UInt16, UInt8 *, UInt8 *) __DEVICE__; 74 | extern UInt32 DeviceGetSupportedDepths() __DEVICE__; 75 | extern Boolean DeviceSupportsVersion(UInt32) __DEVICE__; 76 | extern void *DeviceWindowGetPointer(WinHandle) __DEVICE__; 77 | extern Boolean DeviceBeamDatabase(Char *) __DEVICE__; 78 | extern void DeviceTerminate() __DEVICE__; 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /src/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # @(#)Makefile 3 | # 4 | # Copyright 2000-2002, Aaron Ardiri (mailto:aaron@ardiri.com) 5 | # Michael Ethetton (mailto:methetton@gambitstudios.com) 6 | # All rights reserved. 7 | # 8 | # This file was generated as part of the "liberty" program developed for 9 | # the Palm Computing Platform designed by Palm: http://www.palm.com/ 10 | # 11 | # The contents of this file is confidential and proprietrary in nature 12 | # ("Confidential Information"). Redistribution or modification without 13 | # prior consent of the original author(s) is prohibited. 14 | # 15 | # NOTE: 16 | # The following portions of code found within this source code file are 17 | # owned exclusively by Michael Ethetton, and shall not be used in or 18 | # sold to other projects (internal or external) without the written 19 | # permission of Michael Ethetton. 20 | # 21 | # - z-80 CPU Emulation 22 | # - Nintendo Gameboy Emulation System 23 | # 24 | # The following portions of code found within this source code file are 25 | # owned exclusively by Aaron Ardiri, and shall not be used in or 26 | # sold to other projects (internal or external) without the written 27 | # permission of Aaron Ardiri. 28 | # 29 | # - GNU prc-tools 2.0 application framework 30 | # - Help System 31 | # - Device Configuration Module 32 | # - Multiple Code Segments Solution 33 | # 34 | # It shall be noted that Aaron Ardiri has licensed the above source code 35 | # and framework to Michael Ethetton for use only in the "liberty" project. 36 | # 37 | 38 | # compiler commands 39 | PREFIX = 40 | CC = $(PREFIX)m68k-palmos-gcc 41 | PILRC = $(PREFIX)pilrc 42 | BUILDPRC = $(PREFIX)build-prc 43 | PRC2BIN = $(PREFIX)prc2bin 44 | ENCRYPT = regcode/encrypt 45 | 46 | # source / outputs 47 | BINFILE = liberty 48 | EXEC = $(BINFILE)_$(LANG) 49 | MSEG = $(EXEC)-sections.o $(EXEC)-sections.ld 50 | OBJS = palm.o device.o game.o help_$(LANG).o gameboy.o register.o $(MSEG) 51 | TEMP = tmp.out 52 | 53 | # compiler flags 54 | CCFLAGS = -O2 -Wall -palmos4 -DLANG_$(LANG) -DPROTECTION_$(PROTECTION) 55 | 56 | # compile requirements 57 | all: 58 | LANG=en PROTECTION=OFF make liberty_unprotected 59 | LANG=en PROTECTION=ON make liberty 60 | LANG=fr PROTECTION=ON make liberty 61 | LANG=de PROTECTION=ON make liberty 62 | LANG=es PROTECTION=ON make liberty 63 | 64 | liberty: $(EXEC) $(EXEC).def bin.stamp 65 | $(BUILDPRC) $(EXEC).def $(BINFILE) *.bin 66 | $(PRC2BIN) $(EXEC).prc > $(TEMP) 67 | cp @message code0007.bin regcode/ 68 | $(ENCRYPT) code0002.bin code0006.bin 69 | cp @message code0007.bin 70 | $(BUILDPRC) $(EXEC).def *.bin 71 | make clean 72 | cp $(EXEC).prc .. 73 | 74 | liberty_unprotected: $(EXEC) $(EXEC).def bin.stamp 75 | $(BUILDPRC) $(EXEC).def $(BINFILE) *.bin 76 | make clean 77 | cp $(EXEC).prc ../$(EXEC)_reg.prc 78 | 79 | $(EXEC): $(OBJS) 80 | $(CC) $(OBJS) $(CCFLAGS) -o $(BINFILE) 81 | 82 | $(MSEG): $(EXEC).def 83 | m68k-palmos-multigen $(EXEC).def 84 | $(CC) -c -o $(EXEC)-sections.o $(EXEC)-sections.s 85 | 86 | bin.stamp: $(EXEC).rcp 87 | $(PILRC) -q -D PROTECTION_$(PROTECTION) $(EXEC).rcp 88 | 89 | # compile rules 90 | .SUFFIXES: .c .cc .o 91 | 92 | .c.o: 93 | $(CC) -c $(CCFLAGS) $< 94 | .cc.o: 95 | $(CC) -E $(CCFLAGS) $< > $<.s 96 | $(CC) -c -o $@ $(CCFLAGS) $<.s 97 | 98 | # clean-up funtions 99 | clean: 100 | rm -f *.[oa] *sections.* *.bin *.hdr bin.res *.grc *.s *~ $(TEMP) $(BINFILE) 101 | 102 | distclean: 103 | rm -f *.[oa] *sections.* *.bin *.hdr bin.res *.[pg]rc *.s *~ $(TEMP) $(BINFILE) 104 | -------------------------------------------------------------------------------- /src/hardware/PalmChars.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries. 4 | * All rights reserved. 5 | * 6 | * File: PalmChars.h 7 | * 8 | * Release: 9 | * 10 | * Description: 11 | * Header file for all Palm Devices 12 | * Contains Palm-specific vchrs 13 | * 14 | * History: 15 | * 16 | *****************************************************************************/ 17 | 18 | #ifndef __PALMCHARS_H__ 19 | #define __PALMCHARS_H__ 20 | 21 | #include 22 | 23 | #undef vchrPalmMin 24 | #undef vchrPalmMax 25 | #define vchrPalmMin 0x0500 26 | #define vchrPalmMax 0x05FF 27 | 28 | #define PalmFtrCreator 'PALM' 29 | #define PalmFtrHwrBitsGroup1 0 30 | #define HwrBitsSlider 0x0001 31 | #define HwrBitsVoiceButton 0x0002 32 | #define HwrBitsBuiltInKeyboard 0x0004 33 | #define vchrHard5 0x0214 34 | #define keyBitHard5 0x2000 35 | 36 | #define vchrSilkClock (vchrPalmMin + 0) 37 | #define vchrClock (vchrPalmMin + 1) 38 | #define vchrPopupBrightness (vchrPalmMin + 2) 39 | #define vchrNavChange (vchrPalmMin + 3) 40 | #define vchrNavReserved0 (vchrPalmMin + 4) 41 | #define vchrNavReserved1 (vchrPalmMin + 5) 42 | #define vchrNavReserved2 (vchrPalmMin + 6) 43 | #define vchrNavReserved3 (vchrPalmMin + 7) 44 | 45 | #define keyBitNavLeft 0x01000000 46 | #define keyBitNavRight 0x02000000 47 | #define keyBitNavSelect 0x04000000 48 | #define keyBitNavLRS 0x07000000 49 | 50 | #define navBitUp 0x0001 51 | #define navBitDown 0x0002 52 | #define navBitLeft 0x0004 53 | #define navBitRight 0x0008 54 | #define navBitSelect 0x0010 55 | #define navBitsAll 0x001F 56 | 57 | #define navChangeUp 0x0100 58 | #define navChangeDown 0x0200 59 | #define navChangeLeft 0x0400 60 | #define navChangeRight 0x0800 61 | #define navChangeSelect 0x1000 62 | #define navChangeBitsAll 0x1F00 63 | 64 | #define navFtrCreator 'fway' 65 | #define navFtrVersion 0 66 | 67 | #define navVersion 0x00010000 68 | 69 | #define IsFiveWayNavEvent(eventP) \ 70 | ( \ 71 | (((eventP)->data.keyDown.chr == vchrPageUp) || \ 72 | ((eventP)->data.keyDown.chr == vchrPageDown) || \ 73 | ((eventP)->data.keyDown.chr == vchrNavChange)) \ 74 | && \ 75 | (((eventP)->data.keyDown.keyCode & (navBitsAll | navChangeBitsAll)) != 0) \ 76 | ) 77 | 78 | #define NavSelectPressed(eventP) \ 79 | ( \ 80 | IsFiveWayNavEvent(eventP) && \ 81 | (((eventP)->data.keyDown.modifiers & autoRepeatKeyMask) == 0) && \ 82 | (((eventP)->data.keyDown.keyCode & (navBitsAll | navChangeBitsAll)) == navChangeSelect) \ 83 | ) 84 | 85 | #define NavDirectionPressed(eventP, nav) \ 86 | ( \ 87 | IsFiveWayNavEvent(eventP) \ 88 | ? (((eventP)->data.keyDown.modifiers & autoRepeatKeyMask) \ 89 | ? (((eventP)->data.keyDown.keyCode & (navBitsAll | navChangeBitsAll)) == (navBit ## nav)) \ 90 | : (((eventP)->data.keyDown.keyCode & (navBitsAll | navChangeBitsAll)) == (navBit ## nav | navChange ## nav))) \ 91 | : (((eventP)->data.keyDown.chr == vchrPageUp && navBit ## nav == navBitUp) || \ 92 | ((eventP)->data.keyDown.chr == vchrPageDown && navBit ## nav == navBitDown)) \ 93 | ) 94 | 95 | #define NavKeyPressed(eventP, nav) \ 96 | ( \ 97 | (navBit ## nav == navBitSelect) \ 98 | ? NavSelectPressed(eventP) \ 99 | : NavDirectionPressed(eventP, nav) \ 100 | ) 101 | 102 | #define densityFtrCreator 'dnsT' 103 | #define densityFtrVersion 0 104 | 105 | #endif 106 | -------------------------------------------------------------------------------- /src/regcode/encrypt.c: -------------------------------------------------------------------------------- 1 | /* 2 | * @(#)encrypt.c 3 | * 4 | * Copyright 2000, Aaron Ardiri (mailto:aaron@ardiri.com) 5 | * Michael Ethetton (mailto:methetton@gambitstudios.com) 6 | * All rights reserved. 7 | * 8 | * This file was generated as part of the "liberty" program developed for 9 | * the Palm Computing Platform designed by Palm: http://www.palm.com/ 10 | * 11 | * The contents of this file is confidential and proprietrary in nature 12 | * ("Confidential Information"). Redistribution or modification without 13 | * prior consent of the original author(s) is prohibited. 14 | * 15 | * NOTE: 16 | * The following portions of code found within this source code file are 17 | * owned exclusively by Michael Ethetton, and shall not be used in or 18 | * sold to other projects (internal or external) without the written 19 | * permission of Michael Ethetton. 20 | * 21 | * - z-80 CPU Emulation 22 | * - Nintendo Gameboy Emulation System 23 | * 24 | * The following portions of code found within this source code file are 25 | * owned exclusively by Aaron Ardiri, and shall not be used in or 26 | * sold to other projects (internal or external) without the written 27 | * permission of Aaron Ardiri. 28 | * 29 | * - GNU prc-tools 2.0 application framework 30 | * - Help System 31 | * - Device Configuration Module 32 | * - Multiple Code Segments Solution 33 | * 34 | * It shall be noted that Aaron Ardiri has licensed the above source code 35 | * and framework to Michael Ethetton for use only in the "liberty" project. 36 | */ 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | int 44 | main(int argc, char *argv[]) 45 | { 46 | printf("EnCrYpT v1.0\n"); 47 | printf(" Copyright 2000 Aaron Ardiri (ardiri@palmgear.com)\n\n"); 48 | 49 | // called correctly? 50 | if (argc > 2) { 51 | 52 | FILE *file; 53 | unsigned char key; 54 | unsigned char regi[0x7FFF] = {}; // 32K of memory 55 | unsigned char data[0x7FFF] = {}; // 32K of memory 56 | unsigned short i, j, index, regiLength, dataLength; 57 | unsigned short *ptr; 58 | 59 | // process all data files passed in 60 | for (i=1; i 0x4e71 78 | ptr++; 79 | } 80 | 81 | // starting key = checksum 82 | key = 0; 83 | for (j=0; j 39 | #include 40 | #include 41 | #include 42 | 43 | #define MAX_IDLENGTH 8 44 | 45 | int 46 | main(int argc, char *argv[]) 47 | { 48 | char hex[MAX_IDLENGTH+1] = {}; 49 | char userID[256] = {}; 50 | 51 | printf("keygen Gmbt\n"); 52 | printf(" Copyright 2000 Aaron Ardiri (ardiri@palmgear.com)\n\n"); 53 | 54 | // do we ask for it? 55 | if (argc < 2) { 56 | fprintf(stdout, "userID: "); 57 | fscanf(stdin, "%s", userID); 58 | } 59 | 60 | // supplied at commandline 61 | else { 62 | sscanf(argv[1], "%s", userID); 63 | } 64 | 65 | // maybe it is in hex? 66 | if (sscanf(userID, "%x:%x:%x:%x:%x:%x:%x:%x:%x", 67 | &hex[0], &hex[1], &hex[2], 68 | &hex[3], &hex[4], &hex[5], 69 | &hex[6], &hex[7], &hex[8]) == 9) { 70 | 71 | int i, checksum = 0; 72 | for (i=0; i> NOTE: liberty contains absolutely ZERO arm code! << 26 | 27 | Our internal testing has shown that Liberty running on a Tungsten|T 28 | unit runs at approximately the speed of a 68k device running at 40Mhz. 29 | ------------------------------------------------------------------------ 30 | 31 | You should install the latest version of Liberty onto your device. You 32 | you CAN install the executable and datafiles into flash memory! 33 | 34 | http://www.gambitstudios.com/ 35 | http://www.ardiri.com/palm/liberty 36 | 37 | ------------------------------------------------------------------------ 38 | YOU MUST REMOVE ANY PREVIOUS VERSIONS BEFORE INSTALLATION 39 | ------------------------------------------------------------------------ 40 | 41 | Liberty supports games designed for the original GameBoy. 42 | 43 | Conversion of GameBoy games to the format required on the Palm device is 44 | done using a simple utility that is provided with the download. You can 45 | get game images anywhere on the Internet, but to get started, go here: 46 | 47 | http://www.vintagegaming.com/emulators/gameboyroms.html 48 | http://www.emuunlim.com/ROMs/gameboy.shtml 49 | 50 | Gambit Studios does not endorse the illegal use of commercial games. DO 51 | NOT request illegal images from us - we don't know where you can get 52 | them, and will not respond to your requests. 53 | 54 | When using Windows, you may 'drag and drop' a rom image on top of the 55 | ROM2PDB.EXE in your Windows Explorer, or type in 'ROM2PDB ' 56 | from a DOS prompt, where is the name of the rom file. 57 | 58 | Since not all GameBoy games have been fully tested, we recommend that 59 | you test Liberty on the Palm OS Emulator prior to syncing it to your 60 | device. It can be obtained here: 61 | 62 | http://www.palmos.com/dev/tech/tools/emulator 63 | 64 | and under Settings->Debug Options please uncheck the following: 65 | 66 | [ ] Screen Access 67 | [ ] Hardware Register Access 68 | [ ] UIMgr data access 69 | [ ] Proscribed function call 70 | 71 | Don't install games that crash on the Palm OS Emulator onto your device, 72 | if an error occurs then please report it to the Liberty development team 73 | so we can isolate the problem. 74 | 75 | support@gambitstudios.com 76 | 77 | HOW TO PLAY: 78 | ============ 79 | 80 | Start Liberty by tapping on the application icon in the application 81 | launcher. After a short while, you will be presented with the main 82 | Liberty screen in which you may select a game and start emulation, 83 | remove it from the device, or setup any configuration options. 84 | 85 | REGISTRATION: 86 | ============= 87 | 88 | Liberty is shareware, the demonstration version does not allow emulation 89 | of GB games that are larger than 32Kb in size. To access these features, 90 | a device identification number is required to generate a unique 91 | unlocking registration datafile. 92 | 93 | You can get to the registration screen by selecting the 'Register' menu 94 | item in the 'Game' menu. It is very important to ensure that you copy 95 | down the device identification exactly as it is presented in this dialog 96 | as follows: 97 | 98 | 45:6D:75:6C:61:74:6F:72:39 <--- generated from the "Emulator" username 99 | 100 | It is very common that users copy down this information incorrectly and 101 | hence delay the registration process. An exact match is required for the 102 | restration process to succeed. 103 | 104 | Registration is only $16.95 and can be purchased with a credit card at 105 | Gambit Studios website. You may also purchase at PalmGearHQ either over 106 | the phone or Internet using your credit card. It is also sold with a 107 | registered version of the overclocking utility "AfterBurner" at a dis- 108 | counted price of $22.95. 109 | 110 | www.gambitstudios.com, the official website for Liberty, handles online 111 | registrations and support for this product. 112 | 113 | Please direct all sales enquires to the following email address: 114 | 115 | sales@gambitstudios.com 116 | 117 | Support is available for registered users at: 118 | 119 | support@gambitstudios.com 120 | 121 | Thank you for downloading and using Liberty! 122 | 123 | // Aaron Ardiri 124 | // Michael Ethetton 125 | - the Liberty development team 126 | 127 | ---------------------------------------------------------------------------- 128 | -------------------------------------------------------------------------------- /src/palm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @(#)palm.h 3 | * 4 | * Copyright 2000-2002, Aaron Ardiri (mailto:aaron@ardiri.com) 5 | * Michael Ethetton (mailto:methetton@gambitstudios.com) 6 | * All rights reserved. 7 | * 8 | * This file was generated as part of the "liberty" program developed for 9 | * the Palm Computing Platform designed by Palm: http://www.palm.com/ 10 | * 11 | * The contents of this file is confidential and proprietrary in nature 12 | * ("Confidential Information"). Redistribution or modification without 13 | * prior consent of the original author(s) is prohibited. 14 | * 15 | * NOTE: 16 | * The following portions of code found within this source code file are 17 | * owned exclusively by Michael Ethetton, and shall not be used in or 18 | * sold to other projects (internal or external) without the written 19 | * permission of Michael Ethetton. 20 | * 21 | * - z-80 CPU Emulation 22 | * - Nintendo Gameboy Emulation System 23 | * 24 | * The following portions of code found within this source code file are 25 | * owned exclusively by Aaron Ardiri, and shall not be used in or 26 | * sold to other projects (internal or external) without the written 27 | * permission of Aaron Ardiri. 28 | * 29 | * - GNU prc-tools 2.0 application framework 30 | * - Help System 31 | * - Device Configuration Module 32 | * - Multiple Code Segments Solution 33 | * 34 | * It shall be noted that Aaron Ardiri has licensed the above source code 35 | * and framework to Michael Ethetton for use only in the "liberty" project. 36 | */ 37 | 38 | #ifndef _PALM_H 39 | #define _PALM_H 40 | 41 | // system includes 42 | #include 43 | #include 44 | 45 | // resource "include" :P 46 | #include "resource.h" 47 | 48 | // special includes (additional hardware etc) 49 | #ifdef GAMEPAD 50 | #include "hardware/GPDLib.h" 51 | #endif 52 | #ifdef RUMBLEPAK 53 | #include "hardware/Handspring.h" 54 | #endif 55 | #ifdef SONY 56 | #include "hardware/SonyHR.h" 57 | #include "hardware/SonyChars.h" 58 | #endif 59 | #ifdef HANDERA 60 | #include "hardware/HanderaVGA.h" 61 | #include "hardware/HanderaChars.h" 62 | #endif 63 | #ifdef PALMOS5 64 | #include "hardware/PalmHDD.h" 65 | #endif 66 | #ifdef PALM_5WAY 67 | #include "hardware/PalmChars.h" 68 | #endif 69 | 70 | // application constants and structures 71 | #define appCreator 'Gmbt' 72 | #define keyCreator '_GBK' 73 | #define romType 'gROM' 74 | #define datType '_dat' 75 | #define binType '_bin' 76 | #define saveType 'save' 77 | #define cfgType '_cfg' 78 | #define sramType 'sram' 79 | #define __REGISTER__ __attribute__ ((section ("register")))// code0002.bin 80 | #define __DEVICE__ __attribute__ ((section ("device"))) // code0003.bin 81 | #define __GAME__ __attribute__ ((section ("game"))) // code0004.bin 82 | #define __HELP__ __attribute__ ((section ("help"))) // code0005.bin 83 | #define __SAFE0001__ __attribute__ ((section ("safe0001")))// code0006.bin 84 | #define __SAFE0002__ __attribute__ ((section ("safe0002")))// code0007.bin 85 | 86 | #define ftrGlobals 1000 87 | #define ftrDeviceGlobals 1001 88 | #define ftrGameGlobals 1002 89 | #define ftrHelpGlobals 1003 90 | #define ftrRegisterGlobals 1004 91 | 92 | #define MAX_LISTITEMS 32 // 32 items MAX in the lists 93 | #define GAME_FPS 15 // call "emulateframe" 15 times per second 94 | #define VERSION 0 95 | 96 | enum appEvents 97 | { 98 | appRedrawEvent = firstUserEvent, 99 | appGenerateROMList, 100 | appGenerateSAVEDList 101 | }; 102 | 103 | typedef struct 104 | { 105 | UInt16 ctlKeyButtonA; // key definition for button A 106 | UInt16 ctlKeyButtonB; // key definition for button B 107 | UInt16 ctlKeyUp; // key definition for move up 108 | UInt16 ctlKeyDown; // key definition for move down 109 | UInt16 ctlKeyLeft; // key definition for move left 110 | UInt16 ctlKeyRight; // key definition for move right 111 | 112 | Boolean cfgUseFindCalc; // use the "find" and "calc" buttons 113 | Boolean cfgSkipCPUCycles; // skip CPU cycles (better emu on some) 114 | UInt16 cfgFrameBlit; // frame blit configuration 115 | 116 | UInt16 cfgSoundVolume; // sound volume 117 | Boolean cfgSoundMute; // mute sound? 118 | Boolean cfgSoundChannel1; // channel 1 active? 119 | Boolean cfgSoundChannel2; // channel 2 active? 120 | 121 | UInt8 lgray; // the light gray configuration setting 122 | UInt8 dgray; // the dark gray configuration setting 123 | UInt8 lRGB[3]; // the light gray RGB indexes 124 | UInt8 dRGB[3]; // the dark gray RGB indexes 125 | } ConfigType; 126 | 127 | typedef struct 128 | { 129 | struct 130 | { 131 | UInt8 signatureVersion; // a preference version number 132 | Char signature[16]; // a "signature" for decryption 133 | Char *hotSyncUsername; // the HotSync user name of the user 134 | Boolean showWarning; // do we show the ROM warning? 135 | } system; 136 | 137 | ConfigType config; // default configuration resource 138 | 139 | struct 140 | { 141 | Char strGBRomName[32]; // the currently active ROM! 142 | Boolean restoring; // is this game being restored? 143 | 144 | Boolean gamePlaying; // is there a game in play? 145 | Boolean gamePaused; // is the game currently paused? 146 | 147 | UInt32 keyMaskSpecial; // a little "hack" for start/select 148 | } game; 149 | 150 | } PreferencesType; 151 | 152 | // this is our 'double check' for decryption - make sure it worked :P 153 | #define CHECK_SIGNATURE(x) (StrCompare(x->system.signature, "|HaCkMe|") == 0) 154 | 155 | // local includes 156 | #include "device.h" 157 | #include "help.h" 158 | #include "game.h" 159 | #include "register.h" 160 | 161 | #ifdef PRCTOOLS_FLASHBUG 162 | #include "gccfix.h" // prc-tools 2.0 code resuorce unlock bug :) 163 | #endif 164 | 165 | // functions 166 | extern UInt32 PilotMain(UInt16, MemPtr, UInt16); 167 | extern void InitApplication(void); 168 | extern Boolean ApplicationHandleEvent(EventType *); 169 | extern void ApplicationDisplayDialog(UInt16); 170 | extern void EventLoop(void); 171 | extern void EndApplication(void); 172 | 173 | #endif 174 | -------------------------------------------------------------------------------- /src/sound.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * @(#)sound.inc 3 | * 4 | * Copyright 2000-2002, Aaron Ardiri (mailto:aaron@ardiri.com) 5 | * Michael Ethetton (mailto:methetton@gambitstudios.com) 6 | * All rights reserved. 7 | * 8 | * This file was generated as part of the "liberty" program developed for 9 | * the Palm Computing Platform designed by Palm: http://www.palm.com/ 10 | * 11 | * The contents of this file is confidential and proprietrary in nature 12 | * ("Confidential Information"). Redistribution or modification without 13 | * prior consent of the original author(s) is prohibited. 14 | * 15 | * NOTE: 16 | * The following portions of code found within this source code file are 17 | * owned exclusively by Michael Ethetton, and shall not be used in or 18 | * sold to other projects (internal or external) without the written 19 | * permission of Michael Ethetton. 20 | * 21 | * - z-80 CPU Emulation 22 | * - Nintendo Gameboy Emulation System 23 | * 24 | * The following portions of code found within this source code file are 25 | * owned exclusively by Aaron Ardiri, and shall not be used in or 26 | * sold to other projects (internal or external) without the written 27 | * permission of Aaron Ardiri. 28 | * 29 | * - GNU prc-tools 2.0 application framework 30 | * - Help System 31 | * - Device Configuration Module 32 | * - Multiple Code Segments Solution 33 | * 34 | * It shall be noted that Aaron Ardiri has licensed the above source code 35 | * and framework to Michael Ethetton for use only in the "liberty" project. 36 | */ 37 | 38 | DoSound: 39 | tst.b cfgSoundMute(%a0) | Is sound muted? 40 | bne DoSoundRet | yes, skip sound playing 41 | 42 | DoSound1: 43 | move.w #0xFF00, %d4 44 | btst #7, 0x26(%a1, %d4) | Are sound circuits on? 45 | beq DoSoundRet | No, skip sound 46 | 47 | movem.l %d0-%d4/%a0-%a4, -(%sp) 48 | 49 | tst.b cfgSoundChan2(%a0) | no, Is channel 2 enabled? 50 | bne.s DoSndCh2 | yes, play it 51 | ChkSndCh1: 52 | tst.b cfgSoundChan1(%a0) | 2 not enabled. Is channel 1 enabled? 53 | bne.s DoSndCh1 | yes, play it 54 | movem.l (%sp)+, %d0-%d4/%a0-%a4 55 | bra DoSoundRet 56 | 57 | | *************************** 58 | | UPDATE SOUND CHANNEL 1 59 | | *************************** 60 | 61 | DoSndCh1: 62 | | moveq #0, %d0 | CHANNEL 1 63 | | move.w snd1Freq(%a0), %d0 | Get current freq. 64 | | lsr.w #1, %d0 | If freq=0, dont play 65 | move.l #0x00020000, %d0 66 | move.w #0x0800, %d1 67 | sub.w snd1Freq(%a0), %d1 68 | divu %d1, %d0 69 | and.l #0x0000FFFF, %d0 70 | beq SndUpdate 71 | 72 | moveq #0, %d1 73 | move.b snd1Vol(%a0), %d1 | amplitude 74 | move.b cfgSoundVolume(%a0), %d5 75 | lsl.b %d5, %d1 | shift GB vol. level to Palm level 76 | lsr.b #1, %d1 | (need to allow vol multipliers of 77 | | 1/2, 1, 2, 4) 78 | beq SndUpdate | If vol=0, dont play 79 | PlayCh1: 80 | lea -10(%sp), %sp | Get space for sound structure 81 | move.l %sp, %a1 82 | move.w #0,-(%sp) | sync/async 83 | move.l %a1, -(%sp) | ptr to sound structure 84 | move.l #0,-(%sp) | sound channel 85 | 86 | move.w #0x0303, (%a1)+ | Command: sndFreqDurationAmp 87 | move.l %d0, (%a1)+ | freq 88 | move.w #0x0050, (%a1)+ | duration 89 | move.w %d1, (%a1) | vol 90 | 91 | 92 | trap #15 | Call SndDoCmd 93 | .word 0xA233 94 | lea 20(%sp),%sp 95 | 96 | bra SndUpdate 97 | 98 | 99 | | *************************** 100 | | UPDATE SOUND CHANNEL 2 101 | | *************************** 102 | DoSndCh2: 103 | | moveq #0, %d0 | CHANNEL 2 104 | | move.w snd2Freq(%a0), %d0 | Get current freq. 105 | | lsr.w #1, %d0 | If freq=0, dont play 106 | move.l #0x00020000, %d0 107 | move.w #0x0800, %d1 108 | sub.w snd1Freq(%a0), %d1 109 | divu %d1, %d0 110 | and.l #0x0000FFFF, %d0 111 | beq.s ChkSndCh1 | 112 | 113 | moveq #0, %d1 114 | move.b snd2Vol(%a0), %d1 | amplitude 115 | move.b cfgSoundVolume(%a0), %d5 116 | lsl.b %d5, %d1 | shift GB vol. level to Palm level 117 | lsr.b #1, %d1 | (need to allow vol multipliers of 118 | | 1/2, 1, 2, 4) 119 | beq ChkSndCh1 | if vol=0, dont play 120 | 121 | 122 | tst.b cfgSoundChan1(%a0) | Is channel 1 enabled? 123 | beq.s Ch1NoCheck | no, skip freq comparision 124 | 125 | move.b snd1Vol(%a0), %d2 | Check Channel 1 amplitude 126 | move.b cfgSoundVolume(%a0), %d5 127 | lsl.b %d5, %d2 | shift GB vol. level to Palm level 128 | lsr.b #1, %d2 | (need to allow vol multipliers of 129 | | 1/2, 1, 2, 4) 130 | beq.s Ch1NoCheck | If vol=0, playing ch2 131 | 132 | | move.w snd1Freq(%a0), %d5 133 | | lsr.w #1, %d5 134 | move.l #0x00020000, %d5 135 | move.w #0x0800, %d3 136 | sub.w snd1Freq(%a0), %d3 137 | divu %d3, %d5 138 | and.l #0x0000FFFF, %d5 139 | 140 | beq.s Ch1NoCheck | If freq=0, playing ch2 141 | cmp.w %d0, %d5 | If ch1 Freq => ch2 Freq, 142 | bge.s Ch1NoCheck | do channel 2 143 | move.b %d2, %d1 | else, swap vol 144 | move.w %d5, %d0 | swap freq 145 | | Play channel 1 146 | 147 | Ch1NoCheck: 148 | lea -10(%sp), %sp | Get space for sound structure 149 | move.l %sp, %a1 150 | move.w #0,-(%sp) | sync/async 151 | move.l %a1, -(%sp) | ptr to sound structure 152 | move.l #0,-(%sp) | sound channel 153 | 154 | move.w #0x0303, (%a1)+ | Command: sndFreqDurationAmp 155 | move.l %d0, (%a1)+ | freq 156 | move.w #0x0050, (%a1)+ | duration 157 | move.w %d1, (%a1) | vol 158 | 159 | trap #15 | Call SndDoCmd 160 | .word 0xA233 161 | lea 20(%sp),%sp 162 | 163 | 164 | SndUpdate: 165 | movem.l (%sp)+, %d0-%d4/%a0-%a4 166 | | *** Update Sound Channel Values *** 167 | tst.b snd1Freq(%a0) | See if ch#1 Freq. changing 168 | beq.s snd1chkEnv 169 | subq.b #1, snd1FCtr(%a0) | Decrement counter 170 | bne.s snd1chkEnv 171 | move.b snd1Freq(%a0), snd1FCtr(%a0) | restore counter 172 | 173 | move.w snd1Freq(%a0), %d0 | Get Freq 174 | move.b snd1Div(%a0), %d5 | Get divisor 175 | lsr.w %d5, %d0 | Get freq. change 176 | move.w #0xFF00, %d4 177 | btst.b #3, 0x10(%a1, %d4) | See if freq. up or down 178 | bne.s snd1Fdec 179 | add.w %d0, snd1Freq(%a0) | Increase Freq 180 | cmpi.w #0x07FF, snd1Freq(%a0) | see if max freq 181 | blt.s snd1chkEnv 182 | clr.w snd1Freq(%a0) | yes, no more changes 183 | bra.s snd1chkEnv 184 | snd1Fdec: 185 | sub.w %d0, snd1Freq(%a0) | Decrease Freq 186 | bgt.s snd1chkEnv | if at min. freq 187 | clr.w snd1Freq(%a0) | no more changes 188 | 189 | snd1chkEnv: 190 | tst.b snd1Env(%a0) | See if ch#1 envelope changing 191 | beq.s snd1done 192 | subq.b #1, snd1ECtr(%a0) | Decrement counter 193 | bne.s snd1done 194 | move.b snd1Env(%a0), snd1ECtr(%a0) | restore counter 195 | move.w #0xFF00, %d4 196 | btst.b #3, 0x12(%a1, %d4) | See if attenuate or amplify 197 | beq.s snd1dec 198 | addq.b #1, snd1Vol(%a0) | Amplify by 1 step 199 | cmpi.b #15, snd1Vol(%a0) | see if max volume 200 | blt.s snd1done 201 | clr.b snd1Env(%a0) | yes, no more changes 202 | bra.s snd1done 203 | snd1dec: 204 | subq.b #1, snd1Vol(%a0) | attenuate by 1 step 205 | bgt.s snd1done | if at min. volume, 206 | clr.b snd1Env(%a0) | no more changes 207 | 208 | snd1done: 209 | 210 | snd2chkEnv: 211 | tst.b snd2Env(%a0) | See if ch#2 envelope changing 212 | beq.s snd2done 213 | subq.b #1, snd2ECtr(%a0) | Decrement counter 214 | bne.s snd2done 215 | move.b snd2Env(%a0), snd2ECtr(%a0) | restore counter 216 | move.w #0xFF00, %d4 217 | btst.b #3, 0x17(%a1, %d4) | See if attenuate or amplify 218 | beq.s snd2dec 219 | addq.b #1, snd2Vol(%a0) | Amplify by 1 step 220 | cmpi.b #15, snd2Vol(%a0) | see if max volume 221 | blt.s snd2done 222 | clr.b snd2Env(%a0) | yes, no more changes 223 | bra.s snd2done 224 | snd2dec: 225 | subq.b #1, snd2Vol(%a0) | attenuate by 1 step 226 | bgt.s snd2done | if at min. volume, 227 | clr.b snd2Env(%a0) | no more changes 228 | 229 | snd2done: 230 | 231 | DoSoundRet: 232 | rts 233 | -------------------------------------------------------------------------------- /src/hardware/PalmHDD.h: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * 3 | * Copyright (c) 2002 MobileWizardry 4 | * All rights reservered. 5 | * 6 | *************************************************************************/ 7 | 8 | /* 9 | * @(#)palmHDD.h 10 | * 11 | * -- Aaron Ardiri (mailto:aaron_ardiri@mobilewizardry.com) 12 | * Chip Kerchner (mailto:chip_kerchner@mobilewizardry.com) 13 | * Andrew Empson (mailto:andrew_empson@mobilewizardry.com) 14 | */ 15 | 16 | #ifndef __PALMHDD_H__ 17 | #define __PALMHDD_H__ 18 | 19 | #include 20 | 21 | // bitmap version numbers 22 | #define BitmapVersionThree 3 23 | 24 | // constants used by WinSetCoordinateSystem 25 | #define kCoordinatesNative 0 26 | #define kCoordinatesStandard 72 27 | #define kCoordinatesOneAndAHalf 108 28 | #define kCoordinatesDouble 144 29 | #define kCoordinatesTriple 216 30 | #define kCoordinatesQuadruple 288 31 | 32 | // pixel format defined with BitmapVersion3 33 | typedef enum PixelFormatTag 34 | { 35 | pixelFormatIndexed, // standard for Palm 68k; standard for BMPs 36 | pixelFormat565, // standard for Palm 68k 37 | pixelFormat565LE, // standard for BMPs; popular on ARM hardware 38 | pixelFormatIndexedLE // popular on ARM hardware 39 | } PixelFormatType; 40 | 41 | // constants used by density field 42 | typedef enum DensityTag { 43 | kDensityLow = 72, 44 | kDensityOneAndAHalf = 108, 45 | kDensityDouble = 144, 46 | kDensityTriple = 216, 47 | kDensityQuadruple = 288 48 | } DensityType; 49 | 50 | // selectors for WinScreenGetAttribute 51 | typedef enum WinScreenAttrTag 52 | { 53 | winScreenWidth, 54 | winScreenHeight, 55 | winScreenRowBytes, 56 | winScreenDepth, 57 | winScreenAllDepths, 58 | winScreenDensity, 59 | winScreenPixelFormat, 60 | winScreenResolutionX, 61 | winScreenResolutionY 62 | } WinScreenAttrType; 63 | 64 | // This data structure is the PalmOS 5 version 3 BitmapType. 65 | typedef struct BitmapTypeV3 66 | #ifdef ALLOW_ACCESS_TO_INTERNALS_OF_BITMAPS 67 | { 68 | // BitmapType 69 | Int16 width; 70 | Int16 height; 71 | UInt16 rowBytes; 72 | BitmapFlagsType flags; // see BitmapFlagsType 73 | UInt8 pixelSize; // bits per pixel 74 | UInt8 version; // data structure version 3 75 | 76 | // version 3 fields 77 | UInt8 size; // size of this structure in bytes (0x16) 78 | UInt8 pixelFormat; // format of the pixel data, see pixelFormatType 79 | UInt8 unused; 80 | UInt8 compressionType; // see BitmapCompressionType 81 | UInt16 density; // used by the blitter to scale bitmaps 82 | UInt32 transparentValue; // the index or RGB value of the transparent color 83 | UInt32 nextBitmapOffset; // byte offset to next bitmap in bitmap family 84 | 85 | // if (flags.hasColorTable) 86 | // { 87 | // if (flags.indirectColorTable) 88 | // ColorTableType* colorTableP; // pointer to color table 89 | // else 90 | // ColorTableType colorTable; // color table, could have 0 entries (2 bytes long) 91 | // } 92 | // 93 | // if (flags.indirect) 94 | // void* bitsP; // pointer to actual bits 95 | // else 96 | // UInt8 bits[]; // or actual bits 97 | // 98 | } 99 | #endif 100 | BitmapTypeV3; 101 | typedef BitmapTypeV3* BitmapPtrV3; 102 | 103 | // high density trap selectors 104 | #define HDSelectorBmpGetNextBitmapAnyDensity 0 105 | #define HDSelectorBmpGetVersion 1 106 | #define HDSelectorBmpGetCompressionType 2 107 | #define HDSelectorBmpGetDensity 3 108 | #define HDSelectorBmpSetDensity 4 109 | #define HDSelectorBmpGetTransparentValue 5 110 | #define HDSelectorBmpSetTransparentValue 6 111 | #define HDSelectorBmpCreateBitmapV3 7 112 | #define HDSelectorWinSetCoordinateSystem 8 113 | #define HDSelectorWinGetCoordinateSystem 9 114 | #define HDSelectorWinScalePoint 10 115 | #define HDSelectorWinUnscalePoint 11 116 | #define HDSelectorWinScaleRectangle 12 117 | #define HDSelectorWinUnscaleRectangle 13 118 | #define HDSelectorWinScreenGetAttribute 14 119 | #define HDSelectorWinPaintTiledBitmap 15 120 | #define HDSelectorWinGetSupportedDensity 16 121 | #define HDSelectorEvtGetPenNative 17 122 | #define HDSelectorWinScaleCoord 18 123 | #define HDSelectorWinUnscaleCoord 19 124 | #define HDSelectorWinPaintRoundedRectangleFrame 20 125 | #define HDSelectorInvalid 21 // leave this selector at end 126 | 127 | #define sysTrapSysHighDensitySelector 0xA3EC 128 | #define HIGH_DENSITY_TRAP(selector) _SYSTEM_API(_CALL_WITH_SELECTOR)(_SYSTEM_TABLE, sysTrapSysHighDensitySelector, selector) 129 | 130 | #ifdef __cplusplus 131 | extern "C" 132 | { 133 | #endif 134 | 135 | //----------------------------------------------- 136 | // High Density Bitmap support functions 137 | //----------------------------------------------- 138 | extern BitmapType* BmpGetNextBitmapAnyDensity(BitmapType* bitmapP) 139 | HIGH_DENSITY_TRAP(HDSelectorBmpGetNextBitmapAnyDensity); 140 | 141 | extern UInt8 BmpGetVersion(const BitmapType* bitmapP) 142 | HIGH_DENSITY_TRAP(HDSelectorBmpGetVersion); 143 | 144 | extern BitmapCompressionType BmpGetCompressionType(const BitmapType* bitmapP) 145 | HIGH_DENSITY_TRAP(HDSelectorBmpGetCompressionType); 146 | 147 | extern UInt16 BmpGetDensity(const BitmapType* bitmapP) 148 | HIGH_DENSITY_TRAP(HDSelectorBmpGetDensity); 149 | 150 | extern Err BmpSetDensity(BitmapType* bitmapP, UInt16 density) 151 | HIGH_DENSITY_TRAP(HDSelectorBmpSetDensity); 152 | 153 | extern Boolean BmpGetTransparentValue(const BitmapType* bitmapP, UInt32* transparentValueP) 154 | HIGH_DENSITY_TRAP(HDSelectorBmpGetTransparentValue); 155 | 156 | extern void BmpSetTransparentValue(BitmapType* bitmapP, UInt32 transparentValue) 157 | HIGH_DENSITY_TRAP(HDSelectorBmpSetTransparentValue); 158 | 159 | extern BitmapTypeV3* BmpCreateBitmapV3(const BitmapType* bitmapP, UInt16 density, const void* bitsP, const ColorTableType* colorTableP) 160 | HIGH_DENSITY_TRAP(HDSelectorBmpCreateBitmapV3); 161 | 162 | extern UInt16 WinSetCoordinateSystem(UInt16 coordSys) 163 | HIGH_DENSITY_TRAP(HDSelectorWinSetCoordinateSystem); 164 | 165 | extern UInt16 WinGetCoordinateSystem(void) 166 | HIGH_DENSITY_TRAP(HDSelectorWinGetCoordinateSystem); 167 | 168 | extern Coord WinScaleCoord(Coord coord, Boolean ceiling) 169 | HIGH_DENSITY_TRAP(HDSelectorWinScaleCoord); 170 | 171 | extern Coord WinUnscaleCoord(Coord coord, Boolean ceiling) 172 | HIGH_DENSITY_TRAP(HDSelectorWinUnscaleCoord); 173 | 174 | extern void WinScalePoint(PointType* pointP, Boolean ceiling) 175 | HIGH_DENSITY_TRAP(HDSelectorWinScalePoint); 176 | 177 | extern void WinUnscalePoint(PointType* pointP, Boolean ceiling) 178 | HIGH_DENSITY_TRAP(HDSelectorWinUnscalePoint); 179 | 180 | extern void WinScaleRectangle(RectangleType* rectP) 181 | HIGH_DENSITY_TRAP(HDSelectorWinScaleRectangle); 182 | 183 | extern void WinUnscaleRectangle(RectangleType* rectP) 184 | HIGH_DENSITY_TRAP(HDSelectorWinUnscaleRectangle); 185 | 186 | extern Err WinScreenGetAttribute(WinScreenAttrType selector, UInt32* attrP) 187 | HIGH_DENSITY_TRAP(HDSelectorWinScreenGetAttribute); 188 | 189 | extern void WinPaintTiledBitmap(BitmapType* bitmapP, RectangleType* rectP) 190 | HIGH_DENSITY_TRAP(HDSelectorWinPaintTiledBitmap); 191 | 192 | extern Err WinGetSupportedDensity(UInt16* densityP) 193 | HIGH_DENSITY_TRAP(HDSelectorWinGetSupportedDensity); 194 | 195 | extern void EvtGetPenNative(WinHandle winH, Int16* pScreenX, Int16* pScreenY, Boolean* pPenDown) 196 | HIGH_DENSITY_TRAP(HDSelectorEvtGetPenNative); 197 | 198 | #ifdef __cplusplus 199 | } 200 | #endif 201 | 202 | #endif /* __PALMHDD_H__ */ 203 | -------------------------------------------------------------------------------- /src/help_en.c: -------------------------------------------------------------------------------- 1 | /* 2 | * @(#)help_en.c 3 | * 4 | * Copyright 2000-2002, Aaron Ardiri (mailto:aaron@ardiri.com) 5 | * Michael Ethetton (mailto:methetton@gambitstudios.com) 6 | * All rights reserved. 7 | * 8 | * This file was generated as part of the "liberty" program developed for 9 | * the Palm Computing Platform designed by Palm: http://www.palm.com/ 10 | * 11 | * The contents of this file is confidential and proprietrary in nature 12 | * ("Confidential Information"). Redistribution or modification without 13 | * prior consent of the original author(s) is prohibited. 14 | * 15 | * NOTE: 16 | * The following portions of code found within this source code file are 17 | * owned exclusively by Michael Ethetton, and shall not be used in or 18 | * sold to other projects (internal or external) without the written 19 | * permission of Michael Ethetton. 20 | * 21 | * - z-80 CPU Emulation 22 | * - Nintendo Gameboy Emulation System 23 | * 24 | * The following portions of code found within this source code file are 25 | * owned exclusively by Aaron Ardiri, and shall not be used in or 26 | * sold to other projects (internal or external) without the written 27 | * permission of Aaron Ardiri. 28 | * 29 | * - GNU prc-tools 2.0 application framework 30 | * - Help System 31 | * - Device Configuration Module 32 | * - Multiple Code Segments Solution 33 | * 34 | * It shall be noted that Aaron Ardiri has licensed the above source code 35 | * and framework to Michael Ethetton for use only in the "liberty" project. 36 | * 37 | * ------------------------------------------------------------------------ 38 | * THIS FILE CONTAINS THE ENGLISH LANGUAGE TEXT 39 | * ------------------------------------------------------------------------ 40 | */ 41 | 42 | #include "palm.h" 43 | 44 | typedef struct 45 | { 46 | UInt32 keyMask; 47 | WinHandle helpWindow; 48 | } HelpGlobals; 49 | 50 | #ifdef USE_GLOBALS 51 | // globals object 52 | static HelpGlobals gbls; 53 | static HelpGlobals *globals; 54 | #endif 55 | 56 | /** 57 | * Initialize the instructions screen. 58 | * 59 | * @return the height in pixels of the instructions data area. 60 | */ 61 | UInt16 62 | InitInstructions() 63 | { 64 | const RectangleType rect = {{0,0},{142,427}}; 65 | const CustomPatternType erase = {0,0,0,0,0,0,0,0}; 66 | UInt16 err; 67 | DmOpenRef resourceRef; 68 | UInt16 result = 0; 69 | #ifndef USE_GLOBALS 70 | HelpGlobals *globals; 71 | 72 | // create the globals object, and register it 73 | globals = (HelpGlobals *)MemPtrNew(sizeof(HelpGlobals)); 74 | FtrSet(appCreator, ftrHelpGlobals, (UInt32)globals); 75 | #else 76 | globals = &gbls; 77 | #endif 78 | 79 | // setup the valid keys available at this point in time 80 | globals->keyMask = KeySetMask(~(keyBitsAll ^ 81 | (keyBitPower | keyBitCradle | 82 | keyBitPageUp | keyBitPageDown | 83 | #ifdef HANDERA 84 | keyBitJogUp | keyBitJogDown | 85 | #endif 86 | keyBitAntenna | keyBitContrast))); 87 | 88 | // initialize windows 89 | globals->helpWindow = 90 | WinCreateOffscreenWindow(rect.extent.x,rect.extent.y,screenFormat,&err); 91 | err |= (globals->helpWindow == NULL); 92 | 93 | // open the application's resource database 94 | { 95 | UInt16 card; 96 | LocalID dbID; 97 | 98 | SysCurAppDatabase(&card, &dbID); 99 | resourceRef = DmOpenDatabase(card, dbID, dmModeReadOnly); 100 | } 101 | 102 | // draw the help 103 | if (err == errNone) 104 | { 105 | FontID font; 106 | WinHandle currWindow; 107 | 108 | currWindow = WinGetDrawWindow(); 109 | font = FntGetFont(); 110 | 111 | // draw to help window 112 | WinSetDrawWindow(globals->helpWindow); 113 | WinSetPattern(&erase); 114 | WinFillRectangle(&rect, 0); 115 | 116 | { 117 | Char *str, *ptrStr; 118 | Coord x, y; 119 | 120 | // initialize 121 | y = 2; 122 | str = (Char *)MemPtrNew(256 * sizeof(Char)); 123 | 124 | x = 4; 125 | StrCopy(str, 126 | "Liberty supports games designed for the original GameBoy\231."); 127 | ptrStr = str; 128 | while (StrLen(ptrStr) != 0) 129 | { 130 | UInt8 count = FntWordWrap(ptrStr, rect.extent.x-x); 131 | 132 | x = (rect.extent.x - FntCharsWidth(ptrStr, count)) >> 1; 133 | WinDrawChars(ptrStr, count, x, y); y += FntLineHeight(); x = 4; 134 | ptrStr += count; 135 | } 136 | 137 | // add space (little) 138 | y += FntLineHeight() >> 1; 139 | 140 | // 141 | // "playing" games 142 | // 143 | 144 | StrCopy(str, "GameBoy\231 Games"); 145 | FntSetFont(boldFont); 146 | WinSetUnderlineMode(grayUnderline); 147 | x = (rect.extent.x - FntCharsWidth(str, StrLen(str))) >> 1; 148 | WinDrawChars(str, StrLen(str), x, y); y += FntLineHeight(); 149 | WinSetUnderlineMode(noUnderline); 150 | FntSetFont(font); 151 | 152 | // add space (little) 153 | y += FntLineHeight() >> 1; 154 | 155 | x = 4; 156 | StrCopy(str, 157 | "Select the GameBoy\231 game you wish to play from the list shown."); 158 | ptrStr = str; 159 | while (StrLen(ptrStr) != 0) 160 | { 161 | UInt8 count = FntWordWrap(ptrStr, rect.extent.x-x); 162 | 163 | x = (rect.extent.x - FntCharsWidth(ptrStr, count)) >> 1; 164 | WinDrawChars(ptrStr, count, x, y); y += FntLineHeight(); x = 4; 165 | ptrStr += count; 166 | } 167 | 168 | // add space (little) 169 | y += FntLineHeight() >> 1; 170 | 171 | // show the list 172 | x = 5; 173 | { 174 | MemHandle bitmapHandle = DmGet1Resource('Tbmp', bitmapHelpSelectList); 175 | WinDrawBitmap((BitmapType *)MemHandleLock(bitmapHandle), x, y); 176 | MemHandleUnlock(bitmapHandle); 177 | DmReleaseResource(bitmapHandle); 178 | } 179 | 180 | // add space (little) 181 | y += 44 + (FntLineHeight() >> 1); 182 | 183 | x = 4; 184 | StrCopy(str, 185 | "Using the menu commands you can start emulation or remove any game from \ 186 | your device."); 187 | ptrStr = str; 188 | while (StrLen(ptrStr) != 0) 189 | { 190 | UInt8 count = FntWordWrap(ptrStr, rect.extent.x-x); 191 | 192 | x = (rect.extent.x - FntCharsWidth(ptrStr, count)) >> 1; 193 | WinDrawChars(ptrStr, count, x, y); y += FntLineHeight(); x = 4; 194 | ptrStr += count; 195 | } 196 | 197 | // add space (little) 198 | y += FntLineHeight() >> 1; 199 | 200 | x = 4; 201 | StrCopy(str, 202 | "Each game can be restored or saved at any time and has its own \ 203 | configuration options (see below)."); 204 | ptrStr = str; 205 | while (StrLen(ptrStr) != 0) 206 | { 207 | UInt8 count = FntWordWrap(ptrStr, rect.extent.x-x); 208 | 209 | x = (rect.extent.x - FntCharsWidth(ptrStr, count)) >> 1; 210 | WinDrawChars(ptrStr, count, x, y); y += FntLineHeight(); x = 4; 211 | ptrStr += count; 212 | } 213 | 214 | // add space (little) 215 | y += FntLineHeight() >> 1; 216 | 217 | // 218 | // "configuration" 219 | // 220 | 221 | StrCopy(str, "Configuration"); 222 | FntSetFont(boldFont); 223 | WinSetUnderlineMode(grayUnderline); 224 | x = (rect.extent.x - FntCharsWidth(str, StrLen(str))) >> 1; 225 | WinDrawChars(str, StrLen(str), x, y); y += FntLineHeight(); 226 | WinSetUnderlineMode(noUnderline); 227 | FntSetFont(font); 228 | 229 | // add space (little) 230 | y += FntLineHeight() >> 1; 231 | 232 | x = 4; 233 | StrCopy(str, 234 | "Define the key assignments as appropriate or use the grafitti drawing \ 235 | area as follows:"); 236 | ptrStr = str; 237 | while (StrLen(ptrStr) != 0) 238 | { 239 | UInt8 count = FntWordWrap(ptrStr, rect.extent.x-x); 240 | 241 | x = (rect.extent.x - FntCharsWidth(ptrStr, count)) >> 1; 242 | WinDrawChars(ptrStr, count, x, y); y += FntLineHeight(); x = 4; 243 | ptrStr += count; 244 | } 245 | 246 | // add space (little) 247 | y += FntLineHeight() >> 1; 248 | 249 | // show the grafitti stuff 250 | x = 17; 251 | { 252 | MemHandle bitmapHandle = DmGet1Resource('Tbmp', bitmapHelpStylusControl); 253 | WinDrawBitmap((BitmapType *)MemHandleLock(bitmapHandle), x, y); 254 | MemHandleUnlock(bitmapHandle); 255 | DmReleaseResource(bitmapHandle); 256 | } 257 | 258 | // add space (little) 259 | y += 57 + (FntLineHeight() >> 1); 260 | 261 | x = 4; 262 | StrCopy(str, 263 | "The frame blit option controls how often a GameBoy\231 game frame is \ 264 | copied to the screen."); 265 | ptrStr = str; 266 | while (StrLen(ptrStr) != 0) 267 | { 268 | UInt8 count = FntWordWrap(ptrStr, rect.extent.x-x); 269 | 270 | x = (rect.extent.x - FntCharsWidth(ptrStr, count)) >> 1; 271 | WinDrawChars(ptrStr, count, x, y); y += FntLineHeight(); x = 4; 272 | ptrStr += count; 273 | } 274 | 275 | // add space (little) 276 | y += FntLineHeight() >> 1; 277 | 278 | // 279 | // "display setup" 280 | // 281 | 282 | StrCopy(str, "Display Setup"); 283 | FntSetFont(boldFont); 284 | WinSetUnderlineMode(grayUnderline); 285 | x = (rect.extent.x - FntCharsWidth(str, StrLen(str))) >> 1; 286 | WinDrawChars(str, StrLen(str), x, y); y += FntLineHeight(); 287 | WinSetUnderlineMode(noUnderline); 288 | FntSetFont(font); 289 | 290 | // add space (little) 291 | y += FntLineHeight() >> 1; 292 | 293 | x = 4; 294 | StrCopy(str, 295 | "Adjust the display settings to your liking. If you own a color device \ 296 | you can even colorize the display! What an eye opener!"); 297 | ptrStr = str; 298 | while (StrLen(ptrStr) != 0) 299 | { 300 | UInt8 count = FntWordWrap(ptrStr, rect.extent.x-x); 301 | 302 | x = (rect.extent.x - FntCharsWidth(ptrStr, count)) >> 1; 303 | WinDrawChars(ptrStr, count, x, y); y += FntLineHeight(); x = 4; 304 | ptrStr += count; 305 | } 306 | 307 | // add space (little) 308 | y += FntLineHeight() >> 1; 309 | 310 | StrCopy(str, "ENJOY!"); 311 | FntSetFont(boldFont); 312 | x = (rect.extent.x - FntCharsWidth(str, StrLen(str))) >> 1; 313 | WinDrawChars(str, StrLen(str), x, y); y += FntLineHeight(); 314 | 315 | // clean up 316 | MemPtrFree(str); 317 | } 318 | 319 | FntSetFont(font); 320 | WinSetDrawWindow(currWindow); 321 | 322 | result = rect.extent.y - 1; 323 | } 324 | else 325 | { 326 | result = 0; 327 | ApplicationDisplayDialog(xmemForm); 328 | } 329 | 330 | // close the database we just opened 331 | DmCloseDatabase(resourceRef); 332 | 333 | return result; 334 | } 335 | 336 | /** 337 | * Draw the instructions on the screen. 338 | * 339 | * @param offset the offset height of the window to start copying from. 340 | */ 341 | void 342 | DrawInstructions(UInt16 offset) 343 | { 344 | const RectangleType helpArea = {{0,offset},{142,116}}; 345 | #ifndef USE_GLOBALS 346 | HelpGlobals *globals; 347 | 348 | // get globals reference 349 | FtrGet(appCreator, ftrHelpGlobals, (UInt32 *)&globals); 350 | #endif 351 | 352 | // blit the required area 353 | if (globals->helpWindow != NULL) 354 | WinCopyRectangle(globals->helpWindow, 355 | WinGetDrawWindow(), &helpArea, 3, 16, winPaint); 356 | } 357 | 358 | /** 359 | * Terminate the instructions screen. 360 | */ 361 | void 362 | QuitInstructions() 363 | { 364 | #ifndef USE_GLOBALS 365 | HelpGlobals *globals; 366 | 367 | // get globals reference 368 | FtrGet(appCreator, ftrHelpGlobals, (UInt32 *)&globals); 369 | #endif 370 | 371 | // return the state of the key processing 372 | KeySetMask(globals->keyMask); 373 | 374 | // clean up memory 375 | if (globals->helpWindow != NULL) 376 | WinDeleteWindow(globals->helpWindow, false); 377 | 378 | #ifndef USE_GLOBALS 379 | MemPtrFree(globals); 380 | 381 | // unregister global data 382 | FtrUnregister(appCreator, ftrHelpGlobals); 383 | #endif 384 | } 385 | -------------------------------------------------------------------------------- /src_convertor/rom2pdb.c: -------------------------------------------------------------------------------- 1 | /* 2 | * @(#)rom2pdb.c 3 | * 4 | * Copyright 2000, Aaron Ardiri (mailto:aaron@ardiri.com) 5 | * Michael Ethetton (mailto:methetton@gambitstudios.com) 6 | * All rights reserved. 7 | * 8 | * This file was generated as part of the "rom2pdb" program that generates 9 | * PDB data files for the "liberty" program developed for the Palm Computing 10 | * Platform designed by Palm: http://www.palm.com/ 11 | * 12 | * The contents of this file is confidential and proprietrary in nature 13 | * ("Confidential Information"). Redistribution or modification without 14 | * prior consent of the original author(s) is prohibited. 15 | * 16 | * REVISIONS: 17 | * ---------- 18 | * 19 | * 7-Jul-2000 Aaron Ardiri Creation 20 | * 8-Jul-2000 Aaron Ardiri PDB file is generated in same directory as rom 21 | * 13-Jul-2000 Aaron Ardiri updates to compile under Borland C 5.02 22 | * 26-Jul-2000 Aaron Ardiri TETRIS timing problem: 23 | * - JR Z, 0xFB can be replaced with HALT 24 | * - ofs: 0x02F0, 0x28 --> 0x76 25 | * 30-Jul-2000 Aaron Ardiri generation using smaller rom file format 26 | * 15-Oct-2000 Aaron Ardiri "illegal" character removal from ROM name(s) 27 | */ 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | int 36 | main(int argc, char *argv[]) 37 | { 38 | int result = 0; 39 | 40 | printf("GameBoy (tm) ROM Convertor for Liberty\n"); 41 | printf(" Copyright 2000 Gambit Studios, LLC\n\n"); 42 | printf("Gambit Studios does not endorse the illegal use of commercial\n"); 43 | printf("games. DO NOT request illegal images from us - we dont't know\n"); 44 | printf("where you can get them, and will not respond to your requests.\n\n"); 45 | 46 | // called correctly? 47 | if (argc > 1) { 48 | 49 | unsigned short i; 50 | 51 | // process all data files passed in 52 | for (i=1; i" + non_printable ( < 0x20 + > 0x7f ) 89 | // - replace with "_" 90 | 91 | for (j=0; ((j<15) && (buffer[j] != '\0')); j++) { 92 | if ( 93 | (buffer[j] <= 0x20) || (buffer[j] >= 0x7f) || // unprintable 94 | (buffer[j] == '*' ) || (buffer[j] == '?' ) || 95 | (buffer[j] == '.' ) || (buffer[j] == ',' ) || 96 | (buffer[j] == ':' ) || (buffer[j] == ';' ) || 97 | (buffer[j] == '+' ) || (buffer[j] == '-' ) || 98 | (buffer[j] == '<' ) || (buffer[j] == '>' ) || 99 | (buffer[j] == '(' ) || (buffer[j] == ')' ) || 100 | (buffer[j] == '{' ) || (buffer[j] == '}' ) || 101 | (buffer[j] == '[' ) || (buffer[j] == ']' ) || 102 | (buffer[j] == '\\') || (buffer[j] == '/' ) || 103 | (buffer[j] == '|' ) || (buffer[j] == ':' ) || 104 | (buffer[j] == '~' ) || (buffer[j] == '`' ) || 105 | (buffer[j] == '!' ) || (buffer[j] == '$' ) || 106 | (buffer[j] == '^' ) || (buffer[j] == '&' ) || 107 | (buffer[j] == '\'') || (buffer[j] == '"' ) // illegal chars 108 | ) 109 | buffer[j] = '_'; 110 | } 111 | 112 | // lets generate the correct FULL path for the pdb file generation 113 | { 114 | unsigned char *ptrChr; 115 | memset(outFileName, 0, 512); 116 | strcpy(outFileName, argv[i]); 117 | ptrChr = outFileName + strlen(outFileName)-1; 118 | while ( 119 | (*ptrChr != '/') && // unix 120 | (*ptrChr != '\\') && // windows 121 | (ptrChr > outFileName) // dont go too far back! 122 | ) { 123 | ptrChr--; 124 | } 125 | if (ptrChr > outFileName) 126 | sprintf(ptrChr+1, "%s.pdb", buffer); 127 | else 128 | sprintf(outFileName, "%s.pdb", buffer); 129 | } 130 | 131 | // ok.. lets get the cartidge type 132 | fseek(inFile, 327, SEEK_SET); 133 | fread(&tmp,1,1,inFile); 134 | 135 | printf("CARTRIDGE TYPE: "); 136 | switch (tmp) 137 | { 138 | case 0: printf("ROM only"); break; 139 | case 1: printf("ROM+MBC1"); break; 140 | case 2: printf("ROM+MBC1+RAM"); break; 141 | case 3: printf("ROM+MBC1+RAM+BATTERY"); break; 142 | case 5: printf("ROM+MBC2"); break; 143 | case 6: printf("ROM+MBC2+BATTERY"); break; 144 | case 8: printf("ROM+RAM"); break; 145 | case 9: printf("ROM+RAM+BATTERY"); break; 146 | case 11: printf("ROM+MMM01"); break; 147 | case 12: printf("ROM+MMM01+SRAM"); break; 148 | case 13: printf("ROM+MMM01+SRAM+BATTERY"); break; 149 | case 15: printf("ROM+MBC3+TIMER+BATTERY"); break; 150 | case 16: printf("ROM+MBC3+TIMER+RAM+BATTERY"); break; 151 | case 17: printf("ROM+MBC3"); break; 152 | case 18: printf("ROM+MBC3+RAM"); break; 153 | case 19: printf("ROM+MBC3+RAM+BATTERY"); break; 154 | case 25: printf("ROM+MBC5"); break; 155 | case 26: printf("ROM+MBC5+RAM"); break; 156 | case 27: printf("ROM+MBC5+RAM+BATTERY"); break; 157 | case 28: printf("ROM+MBC5+RUMBLE"); break; 158 | case 29: printf("ROM+MBC5+RUMBLE+SRAM"); break; 159 | case 30: printf("ROM+MBC5+RUMBLE+SRAM+BATTERY"); break; 160 | case 31: printf("POCKET CAMERA"); break; 161 | case 253: printf("Bandai TAMA5"); break; 162 | case 254: printf("Hudson HuC-3"); break; 163 | case 255: printf("Hudson HuC-1 ROM+RAM+BATTERY"); break; 164 | default: printf("UNKNOWN CARTRIDGE"); break; 165 | } 166 | printf("\n"); 167 | 168 | // ok.. lets get the rom size 169 | fseek(inFile, 328, SEEK_SET); 170 | fread(&tmp,1,1,inFile); 171 | 172 | printf("ROM SIZE: "); 173 | switch (tmp) 174 | { 175 | case 0: printf("32Kb"); break; 176 | case 1: printf("64Kb"); break; 177 | case 2: printf("128Kb"); break; 178 | case 3: printf("256Kb"); break; 179 | case 4: printf("512Kb"); break; 180 | case 5: printf("1Mb"); break; 181 | case 6: printf("2Mb"); break; 182 | case 52: printf("1.1Mb"); break; 183 | case 53: printf("1.2Mb"); break; 184 | case 54: printf("1.4Mb"); break; 185 | default: printf("unknown"); break; 186 | } 187 | printf("\n"); 188 | 189 | // ok.. lets get the ram size 190 | fseek(inFile, 329, SEEK_SET); 191 | fread(&tmp,1,1,inFile); 192 | 193 | printf("RAM SIZE: "); 194 | switch (tmp) 195 | { 196 | case 0: printf("None"); break; 197 | case 1: printf("2Kb"); break; 198 | case 2: printf("8Kb"); break; 199 | case 3: printf("32Kb"); break; 200 | case 4: printf("128Kb"); break; 201 | default: printf("unknown"); break; 202 | } 203 | printf("\n"); 204 | 205 | // open the "pdb" file 206 | outFile = fopen(outFileName,"wb"); 207 | 208 | // write the HEADER 209 | fwrite(romName,1,32,outFile); // database name 210 | buffer[0x00] = 0x80; buffer[0x01] = 0x01; 211 | buffer[0x02] = 0x00; buffer[0x03] = 0x01; // flags + version 212 | buffer[0x04] = 0xAD; buffer[0x05] = 0xC0; 213 | buffer[0x06] = 0xBE; buffer[0x07] = 0xA0; // creation time 214 | buffer[0x08] = 0xAD; buffer[0x09] = 0xC0; 215 | buffer[0x0A] = 0xBE; buffer[0x0B] = 0xA0; // modification time 216 | buffer[0x0C] = 0xAD; buffer[0x0D] = 0xC0; 217 | buffer[0x0E] = 0xBE; buffer[0x0F] = 0xA0; // backup time 218 | buffer[0x10] = 0x00; buffer[0x11] = 0x00; 219 | buffer[0x12] = 0x00; buffer[0x13] = 0x00; // modification number 220 | buffer[0x14] = 0x00; buffer[0x15] = 0x00; 221 | buffer[0x16] = 0x00; buffer[0x17] = 0x00; // app info 222 | buffer[0x18] = 0x00; buffer[0x19] = 0x00; 223 | buffer[0x1A] = 0x00; buffer[0x1B] = 0x00; // sort info 224 | buffer[0x1C] = 'g'; buffer[0x1D] = 'R'; 225 | buffer[0x1E] = 'O'; buffer[0x1F] = 'M'; // type 226 | buffer[0x20] = 'G'; buffer[0x21] = 'm'; 227 | buffer[0x22] = 'b'; buffer[0x23] = 't'; // creator 228 | buffer[0x24] = 0x00; buffer[0x25] = 0x00; 229 | buffer[0x26] = 0x00; buffer[0x27] = 0x00; // unique ID seed 230 | buffer[0x28] = 0x00; buffer[0x29] = 0x00; 231 | buffer[0x2A] = 0x00; buffer[0x2B] = 0x00; // next record list 232 | fwrite(buffer,1,0x2C,outFile); 233 | 234 | numRec = (unsigned short)(romSize / 16384); 235 | printf("RECORD COUNT: %d\n", numRec); 236 | 237 | buffer[0x00] = numRec / 256; 238 | buffer[0x01] = numRec % 256; 239 | fwrite(buffer,1,2,outFile); // number of reocrds 240 | 241 | // write the resource headers 242 | offset = 0x50 + (numRec * 10); 243 | for (j=0; j> NOTE: liberty contains absolutely ZERO arm code! << 17 | 18 | Our internal testing has shown that Liberty running on a 19 | Tungsten|T unit runs at approximately the speed of a 68k 20 | device running at 40Mhz. [well done palm - PACE rocks] 21 | 22 | - general updates 23 | 24 | A set of updates, tweaking, compatibility fixes to make 25 | gameplay for various rom images work correctly. 26 | 27 | . optimization for z80 code 28 | . joypad interrupt 29 | . sprite priority bit 30 | . sound updates (better algorithms) 31 | . real-time clock support 32 | . PalmOS key handling (no more jumping out of app!) 33 | 34 | and, a few more *phew* 35 | 36 | - radical emualution 37 | 38 | New algorithm for emulation, to reduce number of gb CPU 39 | cycles emulated per frame. *MAY* cause gfx problems with 40 | some rom images or slow downs :( 41 | 42 | . please provide feedback on this option when enabled! 43 | 44 | 1.2.4/1.2.5 45 | 28-Dec-00 - InnoPak/2V Module support 46 | (http://www.innogear.com/) 47 | 48 | A number of users requested rumble pack support for the 49 | InnoPak/2V springboard module - so here it is :) 50 | 51 | - xmas cleaning 52 | 53 | A few small memory leaks and possible "future" problems 54 | were isolated and cleaned up such that Liberty now runs 55 | without dying harshly on Palm DEBUG rom images (POSE). 56 | 57 | 1.2.3 58 | 01-Dec-00 - Memory Access Module support 59 | (http://www.pjbox.com/data/data-memory.jpg) 60 | 61 | Rumble pack support!!!! 62 | 63 | The Memory Access Module provides three functionalities, 64 | however, we were interested in tapping into only one! :) 65 | The vibrating mechanism allows Liberty to emulate games 66 | that have Rumble Pack support!! Feel the vibrations as 67 | your pinball ball hits the rammers when playing a game 68 | like Pokemon Pinball!! 69 | 70 | - Handspring Flash Module updates 71 | 72 | Revisited the application load/game restore code and put 73 | in additional checks to correctly launch a saved game or 74 | previously active game for a GameBoy rom image stored in 75 | a Springboard module memory area. 76 | 77 | 1.2.2 78 | 29-Nov-00 - GamePad(tm) controller support 79 | (www.palmgamepad.com) 80 | 81 | The ultimate accessory for a GameBoy emulator! Get the 82 | real feeling of a GameBoy device by using this device 83 | produced by World Wide Widget Works. 84 | 85 | =========================================== 86 | 87 | [ up ] [ A ] 88 | [ left ] [ right ] [ B ] 89 | [ down ] 90 | 91 | [ select ] [ start ] 92 | 93 | =========================================== 94 | 95 | 1.2.1 96 | 18-Nov-00 - GameBoy screen emulation fixes 97 | 98 | Fixed some graphic and interrupt glitches that affected 99 | the display and playability of some games. 100 | 101 | - saved game fix 102 | 103 | Added some sanity type checks in the state compression 104 | code to catch *very* rare situations where a soft-reset 105 | can occur (ie: checking bounds etc - slower, but, safer) 106 | 107 | - rom beaming fix 108 | 109 | Modification of the beaming code to prevent the "unknown 110 | file format" error message from being presented when a 111 | rom image with a "." character in the name was beamed. 112 | 113 | 1.2 114 | 15-Nov-00 - z80 emulation fixes 115 | - GameBoy screen emulation rewrite 116 | 117 | The largest bottleneck in Liberty was the manner that we 118 | handled the transition of the GameBoy graphics from the 119 | emulation onto the Palm's display. A complete re-write 120 | has been done, and a 30-70% speed increase has occured! 121 | 122 | - memory management changes 123 | 124 | Cleaned up a bit of the memory management services (such 125 | as saved games, memory initialization) to be "cleaner", 126 | in addition to allowing some games to run! (yay). It is 127 | stuff you dont see, so - you wont even notice it :) 128 | 129 | - sound! 130 | 131 | You asked for it, and now - you have it! Bleep-Blop etc, 132 | the presence of sound may wish you never wanted it :) it 133 | works great on some games, and can be totally annoying 134 | on others - but, its there. configure to your liking :)) 135 | 136 | By default, we have disabled the sound - so turn it on! 137 | 138 | - configuration adjustments 139 | 140 | Its been on the wish-list since day one, and its finally 141 | here! *yay*. Configure your controls / colors / tweaks 142 | on a game by game basis! No more tweaking each time you 143 | start your favourite games! 144 | 145 | 1.1.1 146 | 17-Oct-00 - z80 emulation fixes 147 | - ROM loading fixes 148 | 149 | General purpose bug-fixes/enhancements here, a number of 150 | games that didn't work in earlier versions now do. visor 151 | users may now install roms into the flash module and get 152 | access to playing (no more NULL dbID passed error). 153 | 154 | - controller additions 155 | 156 | Modifications have been made such that the user can use 157 | the grafitti area for pressing buttons. This feature can 158 | be useful in some games (walking) however it has a few 159 | limitations. 160 | 161 | [ U+L ][ U ][ U+R ] [ BUTTON A ] 162 | [ L ][ ][ R ] ------------ 163 | [ D+L ][ D ][ D+R ] [ BUTTON B ] 164 | 165 | +-------------------+ +----------+ 166 | alphabetic numeric 167 | 168 | It is not possible to press a direction AND a button at 169 | the same time (limitation of Palm, only ONE pen) :P 170 | 171 | - 32K rom limit removed (in demo) 172 | 173 | The 32K rom limit has now been lifted. Included is a new 174 | file called "Gmbt_TRIAL.pdb", which when installed will 175 | allow you to test gameboy games greater than 32K. 176 | 177 | This trial feature is available ONLY for 30 executions. 178 | After the application has been started 30 times, it will 179 | become "unregistered", and will be limited to 32K roms. 180 | 181 | - color changes! 182 | 183 | Running Liberty on color devices now lets you get a nice 184 | feeling of what you can do with color (did you all miss 185 | the color tweaking configuration screen?) 186 | 187 | Liberty runs in lovely default colors (if available): 188 | 189 | . musky yellow and 190 | . musky blue 191 | 192 | See "pikachu" in his correct colors in Pokemon! :P 193 | 194 | - improved rom2pdb :P 195 | 196 | Generating datafiles on various operating systems caused 197 | a few problems when just "adding" the name of the rom to 198 | the output file generation. 199 | 200 | 1.1 201 | 22-Aug-00 - z80 core update 202 | - Press All Keys support 203 | 204 | The z80 core went through a serious optimization bashing 205 | tweaking every last nano-second out of the emulator. At 206 | the same time, heaps of modifications to support various 207 | GameBoy games, such as echo-ram etc. 208 | 209 | - smaller roms!!! 210 | 211 | We heard ya, and since we squeezed enough speed from the 212 | z80 emulation core - a few nano-seconds could be spared 213 | without you even noticing a difference from 1.0e :)) 214 | 215 | If you install an OLDER rom format, it will let you know 216 | when you try and run it -> YOU MUST RECONVERT THE ROM!!! 217 | 218 | - rom BEAMING support 219 | 220 | Share... Share... Share... 221 | 222 | Please be aware that some overclocking tools dont allow 223 | beaming of "databases" when the system is overlocked. If 224 | you are having problems with beaming, disable them and 225 | try again. 226 | 227 | - GameState Save [individual games] 228 | 229 | Now you can cheat :) Save the state of the current game 230 | that is running, exit out of the game, and then through 231 | our little save-state manager you can delete or continue 232 | the game where you left off! We know space is an issue, 233 | so we compressed them too. 234 | 235 | 1.0e 236 | 12-Jul-00 - z80 core update 237 | - serial interrupt implementation 238 | - countdown timer fixes 239 | 240 | A small number of modifications to the emulation engine 241 | that provides support / fixes for various GameBoy games 242 | being emulated. 243 | 244 | - GameState Save Fix [for exit-return ONLY] 245 | 246 | We forgot to keep track of the current bank index :)) 247 | 248 | 1.0d 249 | 09-Jul-00 - ROM Emulation Warning Dialog 250 | 251 | Emulators are fragile things :) We recommend that users 252 | test the GameBoy emulation on the PalmOS Emualtor (POSE) 253 | prior to installing them into their device. Not all ROM 254 | images are emulated perfectly, and may cause your device 255 | to crash unexpectedly. 256 | 257 | - GameState Save [for exit-return ONLY] 258 | 259 | If the user is emulating a GameBoy game and wants to get 260 | out temporarially, tapping on the [apps] button and then 261 | restarting Liberty would return them to where they were 262 | when they left. 263 | 264 | 1.0c 265 | 07-Jul-00 - New Memory Management Architecture 266 | 267 | The use of undocumented PalmOS API calls were taken out 268 | of the application, which was causing pernament memory 269 | corruption to the device - *ouch*. 270 | 271 | GREETZ TO: Gacel, pthree, irq, raja and setuid! 272 | 273 | 1.0, 1.0a, 1.0b 274 | 06-Jul-00 - Offical Release of Liberty 275 | 276 | Memory Management architecture of these versions proved 277 | fatal to many Palm Computing Platform users based on the 278 | manner in which the emulator was executing. Untrusted 279 | pointers were generated by the emulation engine and data 280 | access (which was unprotected) lead to the overwriting 281 | of data/applications within the device. DO NOT install 282 | these versions or installed to your device - the problem 283 | occured with specific gameboy rom images that were not 284 | tested (there are over 1000 rom image) within the lab. 285 | 286 | // Aaron Ardiri 287 | // Michael Ethetton 288 | - the Liberty development team 289 | 290 | ---------------------------------------------------------------------------- 291 | -------------------------------------------------------------------------------- /src/hardware/HanderaVGA.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * 3 | * Copyright (c) 2001, TRG, All Rights Reserved 4 | * 5 | *--------------------------------------------------------------------------- 6 | * FileName: 7 | * Vga.h 8 | * 9 | * Description: 10 | * VGA API definitions. 11 | * 12 | * 13 | ****************************************************************************/ 14 | 15 | #ifndef __VGA_H__ 16 | #define __VGA_H__ 17 | 18 | #define _TRG_CALL_WITH_16BIT_SELECTOR(table, vector, selector)\ 19 | __attribute__ ((__callseq__ (\ 20 | "move.w #" _Str(selector) ",%%d2; "\ 21 | "trap #" _Str(table) "; dc.w " _Str(vector) ))) 22 | #define TRG_TRAP(sel) \ 23 | _TRG_CALL_WITH_16BIT_SELECTOR(_SYSTEM_TABLE, sysTrapOEMDispatch, sel) 24 | #define EXT_TRAP(x) TRG_TRAP(x) 25 | 26 | #define TRGSysFtrID 'TRG ' 27 | #define TRGVgaFtrNum 2 28 | 29 | /*-------------------------------------------------------------------------- 30 | * Vga result codes 31 | * (oemErrorClass is reserved for Palm licensees). 32 | *-------------------------------------------------------------------------*/ 33 | #define vgaErrorClass (oemErrorClass | 0x200) 34 | 35 | #define vgaErrUnimplemented (vgaErrorClass | 0) // function not implemented (on this hardware) 36 | #define vgaErrBadParam (vgaErrorClass | 1) // invalid parameter 37 | #define vgaErrModeUnsupported (vgaErrorClass | 2) // does not support screen mode 38 | #define vgaErrScreenLocked (vgaErrorClass | 3) // ??? 39 | 40 | /*--------------------------------------------------------------------------- 41 | * Extension Installed 42 | *--------------------------------------------------------------------------*/ 43 | #define _TRGVGAFeaturePresent(versionPtr) \ 44 | (Boolean)(FtrGet(TRGSysFtrID, TRGVgaFtrNum, versionPtr) == 0) 45 | 46 | 47 | /*--------------------------------------------------------------------------- 48 | * Notification that the screen area changed (silk minimize/maximized, rotation) 49 | *--------------------------------------------------------------------------*/ 50 | #define displayExtentChangedEvent ((eventsEnum)(firstUserEvent-2)) 51 | typedef struct displayExtentChangedDataType 52 | { 53 | RectangleType oldDim; 54 | RectangleType newDim; 55 | } displayExtentChangedDataType; 56 | 57 | /*--------------------------------------------------------------------------- 58 | * Macro to simplify getting the data out of the event structure. 59 | * Example: 60 | * yDiff = displayExtentChangedData(eventP)->newDim->extent.y - 61 | * displayExtentChangedData(eventP)->oldDim->extent.y; 62 | *--------------------------------------------------------------------------*/ 63 | #define displayExtentChangedData(eventP) ((displayExtentChangedDataType *)(&((eventP)->data.generic))) 64 | 65 | 66 | 67 | 68 | /*--------------------------------------------------------------------------- 69 | * Screen and rotation modes 70 | *--------------------------------------------------------------------------*/ 71 | typedef enum 72 | { 73 | screenModeScaleToFit = 0, 74 | screenMode1To1, 75 | screenModeOffset //System Use Only 76 | } VgaScreenModeType; 77 | 78 | typedef enum 79 | { 80 | rotateModeNone = 0, 81 | rotateMode90, 82 | rotateMode180, 83 | rotateMode270 84 | } VgaRotateModeType; 85 | 86 | /*--------------------------------------------------------------------------- 87 | * Legacy app display modes. 88 | *--------------------------------------------------------------------------*/ 89 | typedef enum 90 | { 91 | offsetModeTopLeft = 0, 92 | offsetModeTopCenter, 93 | offsetModeTopRight, 94 | offsetModeCenterLeft, 95 | offsetModeCenterCenter, 96 | offsetModeCenterRight, 97 | offsetModeBottomLeft, 98 | offsetModeBottomCenter, 99 | offsetModeBottomRight 100 | } VgaOffsetModeType; 101 | 102 | /*--------------------------------------------------------------------------- 103 | * Font Select Types 104 | *--------------------------------------------------------------------------*/ 105 | typedef enum 106 | { 107 | vgaFontSelectPalm = 0, 108 | vgaFontSelectVgaText 109 | } VgaFontSelectType; 110 | 111 | /*--------------------------------------------------------------------------- 112 | * Form Modify Types 113 | *--------------------------------------------------------------------------*/ 114 | typedef enum 115 | { 116 | vgaFormModify160To240 = 0 117 | } VgaFormModifyType; 118 | 119 | /*--------------------------------------------------------------------------- 120 | * Vga Screen State 121 | *--------------------------------------------------------------------------*/ 122 | typedef struct VgaScreenStateType 123 | { 124 | VgaScreenModeType mode; 125 | VgaRotateModeType rotate; 126 | VgaOffsetModeType offset; 127 | } VgaScreenStateType; 128 | 129 | #ifdef __cplusplus 130 | extern "C" { 131 | #endif 132 | 133 | #define trgMinVgaFunction 0x0200 134 | #define trgGetScreenMode (trgMinVgaFunction + 0) 135 | #define trgSetScreenMode (trgMinVgaFunction + 1) 136 | #define trgBitmapExpandedExtent (trgMinVgaFunction + 2) 137 | #define trgNOP (trgMinVgaFunction + 3) //Remove 138 | #define trgWinDrawBitmapExpanded (trgMinVgaFunction + 4) 139 | #define trgBaseToVgaFont (trgMinVgaFunction + 5) 140 | #define trgFontSelect (trgMinVgaFunction + 6) 141 | #define trgGetFrmTitleHeight (trgMinVgaFunction + 7) 142 | #define trgIsVgaFont (trgMinVgaFunction + 8) 143 | #define trgVgaEnable (trgMinVgaFunction + 9) 144 | #define trgVgaDisable (trgMinVgaFunction + 10) 145 | #define trgVgaIsEnabled (trgMinVgaFunction + 11) 146 | #define trgGetLegacyMode (trgMinVgaFunction + 12) 147 | #define trgSetLegacyMode (trgMinVgaFunction + 13) 148 | #define trgTableUseBaseFont (trgMinVgaFunction + 14) 149 | #define trgFrmModify (trgMinVgaFunction + 15) 150 | #define trgVgaToBaseFont (trgMinVgaFunction + 16) 151 | #define trgReloadAppPrefs (trgMinVgaFunction + 17) 152 | #define trgSaveScreenState (trgMinVgaFunction + 18) 153 | #define trgRestoreScreenState (trgMinVgaFunction + 19) 154 | #define trgRotateSelect (trgMinVgaFunction + 20) 155 | #define trgMaxVgaFunction 0x0214 156 | 157 | 158 | /******************************************************************** 159 | * VGA API Prototypes 160 | ********************************************************************/ 161 | 162 | /*--------------------------------------------------------------------------- 163 | * Returns the current mode and rotation settings 164 | *--------------------------------------------------------------------------*/ 165 | extern void VgaGetScreenMode(VgaScreenModeType *mode, VgaRotateModeType *rotation) 166 | EXT_TRAP(trgGetScreenMode); 167 | 168 | /*--------------------------------------------------------------------------- 169 | * Set current screen mode. 170 | *--------------------------------------------------------------------------*/ 171 | extern Err VgaSetScreenMode(VgaScreenModeType mode, VgaRotateModeType rotation) 172 | EXT_TRAP(trgSetScreenMode); 173 | 174 | /*--------------------------------------------------------------------------- 175 | * Pass in non-expanded bitmap and destination, returns the X & Y extent 176 | * the expanded bitmap. 177 | *--------------------------------------------------------------------------*/ 178 | extern void VgaBitmapExpandedExtent(BitmapPtr bitmapP, Coord *extentX, Coord *extentY) 179 | EXT_TRAP(trgBitmapExpandedExtent); 180 | 181 | /*--------------------------------------------------------------------------- 182 | * Draw the bitmap at 1.5 scale. This is needed for non 160x160 applications 183 | * that need to expand existing small bitmaps. (IE Launcher) 184 | *--------------------------------------------------------------------------*/ 185 | extern void VgaWinDrawBitmapExpanded(BitmapPtr bitmapP, Coord x, Coord y) 186 | EXT_TRAP(trgWinDrawBitmapExpanded); 187 | 188 | /*--------------------------------------------------------------------------- 189 | * Take the Palm font and return the 1.5 scale font 190 | *--------------------------------------------------------------------------*/ 191 | extern FontID VgaBaseToVgaFont(FontID font) 192 | EXT_TRAP(trgBaseToVgaFont); 193 | 194 | /*--------------------------------------------------------------------------- 195 | * Take the Vga font and return the Palm font 196 | *--------------------------------------------------------------------------*/ 197 | extern FontID VgaVgaToBaseFont(FontID font) 198 | EXT_TRAP(trgVgaToBaseFont); 199 | 200 | /*--------------------------------------------------------------------------- 201 | * Display the TRG Select Font dialog which shows the 4 Palm text fonts 202 | * plus the 4 equivalent TRG larger fonts. 203 | *--------------------------------------------------------------------------*/ 204 | extern FontID VgaFontSelect(VgaFontSelectType selectFormType, FontID fontID) 205 | EXT_TRAP(trgFontSelect); 206 | 207 | /*--------------------------------------------------------------------------- 208 | * Is font a 1.5 expanded font. 209 | *--------------------------------------------------------------------------*/ 210 | extern Boolean VgaIsVgaFont(FontID font) 211 | EXT_TRAP(trgIsVgaFont); 212 | 213 | /*--------------------------------------------------------------------------- 214 | * Use small Palm font when drawing tableItemStyles excluding customTableItem 215 | * which determines its 216 | *--------------------------------------------------------------------------*/ 217 | extern void VgaTableUseBaseFont(TablePtr table, Boolean on) 218 | EXT_TRAP(trgTableUseBaseFont); 219 | 220 | /*--------------------------------------------------------------------------- 221 | * Return the heigth of the Titlebar. Necessary for placement of form text 222 | * and objects 223 | *--------------------------------------------------------------------------*/ 224 | extern UInt16 VgaGetFrmTitleHeight(void) 225 | EXT_TRAP(trgGetFrmTitleHeight); 226 | 227 | /*--------------------------------------------------------------------------- 228 | * VgaEnable 229 | *--------------------------------------------------------------------------*/ 230 | extern void VgaEnable(Boolean redraw) 231 | EXT_TRAP(trgVgaEnable); 232 | 233 | /*--------------------------------------------------------------------------- 234 | * VgaDisable 235 | *--------------------------------------------------------------------------*/ 236 | extern void VgaDisable(Boolean redraw) 237 | EXT_TRAP(trgVgaDisable); 238 | 239 | /*--------------------------------------------------------------------------- 240 | * VgaIsEnabled 241 | *--------------------------------------------------------------------------*/ 242 | extern Boolean VgaIsEnabled(void) 243 | EXT_TRAP(trgVgaIsEnabled); 244 | 245 | /*--------------------------------------------------------------------------- 246 | * VgaGetLegacyMode 247 | *--------------------------------------------------------------------------*/ 248 | extern void VgaGetLegacyMode(VgaScreenModeType *viewMode, VgaOffsetModeType *offsetMode) 249 | EXT_TRAP(trgGetLegacyMode); 250 | 251 | /*--------------------------------------------------------------------------- 252 | * VgaSetLegacyMode 253 | *--------------------------------------------------------------------------*/ 254 | extern void VgaSetLegacyMode(VgaScreenModeType viewMode, VgaOffsetModeType offsetMode) 255 | EXT_TRAP(trgSetLegacyMode); 256 | 257 | /*--------------------------------------------------------------------------- 258 | * VgaFormModify 259 | *--------------------------------------------------------------------------*/ 260 | extern Err VgaFormModify(FormType *frmP, VgaFormModifyType type) 261 | EXT_TRAP(trgFrmModify); 262 | 263 | /*--------------------------------------------------------------------------- 264 | * VgaFormModify 265 | * 266 | * #define to allow the old VgaFrmModify routine. Please change your code to 267 | * use the new VgaFormModify routine above. This #define will be removed in 268 | * the future. 269 | *--------------------------------------------------------------------------*/ 270 | #define VgaFrmModify(frmP, type) (VgaFormModify((frmP, type))) 271 | 272 | /*--------------------------------------------------------------------------- 273 | * VgaLoadAppPrefs 274 | *--------------------------------------------------------------------------*/ 275 | extern void VgaReloadAppPrefs(void) 276 | EXT_TRAP(trgReloadAppPrefs); 277 | 278 | /*--------------------------------------------------------------------------- 279 | * VgaSaveScreenState 280 | *--------------------------------------------------------------------------*/ 281 | extern void VgaSaveScreenState(VgaScreenStateType *state) 282 | EXT_TRAP(trgSaveScreenState); 283 | 284 | /*--------------------------------------------------------------------------- 285 | * VgaRestoreScreenState 286 | *--------------------------------------------------------------------------*/ 287 | extern Err VgaRestoreScreenState(VgaScreenStateType *state) 288 | EXT_TRAP(trgRestoreScreenState); 289 | 290 | /*--------------------------------------------------------------------------- 291 | * VgaRestoreScreenState 292 | *--------------------------------------------------------------------------*/ 293 | extern Err VgaRestoreScreenState(VgaScreenStateType *state) 294 | EXT_TRAP(trgRestoreScreenState); 295 | 296 | /*--------------------------------------------------------------------------- 297 | * VgaRotateSelect 298 | *--------------------------------------------------------------------------*/ 299 | extern VgaRotateModeType VgaRotateSelect (VgaRotateModeType rotateMode) 300 | EXT_TRAP(trgRotateSelect); 301 | 302 | 303 | #ifdef __cplusplus 304 | } 305 | #endif 306 | 307 | #endif // __VGA_H__ 308 | -------------------------------------------------------------------------------- /FAQ.txt: -------------------------------------------------------------------------------- 1 | ---------------------------------------------------------------------------- 2 | Liberty version 1.3.1 3 | ---------------------------------------------------------------------------- 4 | 5 | Gambit Studios 6 | Frequently Asked Questions 7 | Liberty version 1.3.1 8 | 9 | ---------------------------------------------------------------------------- 10 | 11 | 1. What is Liberty? 12 | 2. What is a GameBoy(tm)? 13 | 3. What is a GameBoy(tm) ROM image? 14 | 4. Where can I find GameBoy(tm) ROM image files? 15 | 5. Where can I find GameBoy(tm) ROM image files (32K)? 16 | 6. How do I convert GameBoy(tm) ROM image files for use with Liberty? 17 | 7. How do I configure Liberty? 18 | 8. Why is Liberty slow? 19 | 9. How can I make Liberty faster? 20 | 10. Why is there no sound in Liberty? 21 | 11. Why am I getting errors for saving and loading of games? 22 | 12. Why does beaming of ROM images not work? 23 | 13. How can I purchase Liberty? 24 | 14. Who are the guys behind Liberty? 25 | 26 | ---------------------------------------------------------------------------- 27 | 28 | 1. What is Liberty? 29 | 30 | Liberty is the first GameBoy(tm) emulator for devices that use the 31 | Palm Computing Platform, using PalmOS 3.0 or later. Please consult 32 | your device to identify if it is compatible with Liberty, using the 33 | App->Info dialog (selecting Version) in the application launcher. 34 | 35 | The following devices are known not to work with Liberty: 36 | 37 | Pilot 1000, 5000 38 | Palm Personal, Professional 39 | 40 | ---------------------------------------------------------------------------- 41 | 42 | 2. What is a GameBoy(tm)? 43 | 44 | GameBoy(tm) is a device designed by Nintendo who's sole purpose is 45 | to provide the user with the ability to play computer games. It used 46 | an 8-bit processor (similar to 8080/z80), 8K of RAM, 8K of video RAM 47 | and a screen resolution of 160x144 (2.6" in size). It provided 2 bit 48 | grayscale graphics. 49 | 50 | Liberty only supports original GameBoy(tm) games. 51 | 52 | ---------------------------------------------------------------------------- 53 | 54 | 3. What is a GameBoy(tm) ROM image? 55 | 56 | GameBoy(tm) games were distributed using a plug-in cart system. This 57 | cart contains the program code and additional memory for the game it 58 | provides. A GameBoy(tm) ROM image is a direct duplicate of what is 59 | stored on this cart. Each bank is 16K in size and each cart always 60 | has an even number of banks (multiple of 32K). 61 | 62 | ---------------------------------------------------------------------------- 63 | 64 | 4. Where can I find GameBoy(tm) ROM image files? 65 | 5. Where can I find GameBoy(tm) ROM image files (32K)? 66 | 67 | Gambit Studios does not endorse the illegal use of commercial games. 68 | DO NOT request illegal images from us - we don't know where you can 69 | get them, and will not respond to your requests. 70 | 71 | GameBoy(tm) ROM images are available on the Internet - start here: 72 | 73 | http://www.vintagegaming.com/emulators/gameboyroms.html 74 | http://www.emuunlim.com/ROMs/gameboy.shtml 75 | 76 | GambitStudios provides pre-converted GameBoy(tm) ROM images of free 77 | and demonstration roms at the following URL: 78 | 79 | http://www.gambitstudios.com/freesoftware.asp 80 | 81 | A large number of freeware and public domain GameBoy(tm) ROM images 82 | can be found here: 83 | 84 | http://welcome.to/kojote/ 85 | 86 | There are at least 80 commercial games available for the GameBoy(tm) 87 | that are 32K in size. These include, but, are not limited to: 88 | 89 | Dr. Mario, Tetris, World Bowling, 90 | Tennis, Scramble, Asteroids, 91 | Centipede, Bomb Jack, Hyper Lode Runner and many more!!! 92 | 93 | UPDATE: (1.1.1) lifting of 32K demo limit: you can use >32K rom files! 94 | . the demo limit is ONLY valid for the first 32 executions of 95 | the Liberty application, after this - you MUST register :)) 96 | 97 | ---------------------------------------------------------------------------- 98 | 99 | 6. How do I convert GameBoy(tm) ROM image files for use with Liberty? 100 | 101 | Liberty is distributed with a GameBoy(tm) ROM image utility. This 102 | program just splits the ROM image up into a readable format on the 103 | Palm Computing Platform. 104 | 105 | Various executables are available, depending on your platform. 106 | 107 | liberty.zip = PC platform 108 | 109 | 16bit MSDOS program 110 | 32bit Windows program (drag + drop compatable) 111 | 32bit Windows GUI program <<-- NEW! 112 | InstallBuddy PlugIn 113 | 114 | The easiest way to convert ROMS to pdb files is 115 | to copy them into a single directory such as: 116 | 117 | C:\GBROMS 118 | 119 | Make sure the rom2pdb.exe and gb2pdb.bat are in 120 | this directory as well and then type "gb2pdb" 121 | and press [enter]. Install the .pdb files using 122 | the software provided with the device. 123 | 124 | UPDATE: (2002) new win32 conversion utility!!!! 125 | - converts and hotsyncs directly! get it 126 | 127 | http://www.gambitstudios.com/download.asp 128 | 129 | liberty.sit = Macintosh platform 130 | 131 | Macintosh Executable (drag + drop) 132 | 133 | liberty.tar.gz = *nix platform 134 | 135 | gcc -o rom2pdb rom2pdb.c 136 | 137 | The source code is provided in each distribution, so the utility can 138 | be re-compiled to suit your own likings :) 139 | 140 | ---------------------------------------------------------------------------- 141 | 142 | 7. How do I configure Liberty? 143 | 144 | Liberty has a number of configuration options that allows the best 145 | gameplay environment: 146 | 147 | - key assignments 148 | 149 | You can adjust the configuration of the hardware buttons to suit 150 | the GameBoy(tm) games that are emulated in Liberty. The default 151 | configuration gives the four center buttons as the joy pad, with 152 | button A on the right and button B on the left. 153 | 154 | - grayscale configuration 155 | 156 | If you are having problems seeing the grayscale tones, you can 157 | make adjustments using this configuration screen. It is only 158 | available on devices that use 2bpp grayscale graphics displays. 159 | 160 | - color tweaking 161 | 162 | Some Palm devices are color, why should Liberty be a boring old 163 | grayscale application? You can tweak the grayscale colors to a 164 | set of colors using RGB configurations. 165 | 166 | Experiment with the different options to find a good system :) 167 | 168 | - frame blit 169 | 170 | You can control the rate at which the Palm screen is updated by 171 | setting this value. "Every Frame" is the slowest, however, once 172 | an overclocking utility is used "Every 2nd Frame" yeilds very 173 | good animations and game play feel. 174 | 175 | If you are having problems using your hardware keys or feel Liberty 176 | is running very slow - you should disable any uneccessary hacks and 177 | perform a soft-reset and restart liberty. 178 | 179 | UPDATE: (1.2) game by game configuration!! finally! 180 | . you can now use the flexibility of configuring each game on 181 | a game by game basis! no more tweaking each time you play. 182 | 183 | ---------------------------------------------------------------------------- 184 | 185 | 8. Why is Liberty slow? 186 | 9. How can I make Liberty faster? 187 | 188 | Liberty is an emulator. Emulation requires in many cases at least 8x 189 | (10 times in reality) of CPU power to emulate a particular type of 190 | CPU. The Palm's CPU, bundled with the resources required by the Palm 191 | Operating System is not sufficient to run at full speed. 192 | 193 | Overclocking is not supported by Palm Computing and the use of these 194 | types of programs is at your OWN risk. Various applications exist 195 | that can do this task. Afterburner 3.0 has been tested internally 196 | and works with no problems, however, results may vary. 197 | 198 | You should see some substantial increase in performance as soon as 199 | the device is overclocked. If you do not see any improvement, you 200 | should consult the utilities manual to ensure that the program is 201 | doing what it should. 202 | 203 | The following url provides an example of how to overclock: 204 | 205 | http://www.ardiri.com/index.cfm?redir=palm&cat=liberty&subcat=overclck 206 | 207 | You can use the "Benchmark" program to ensure your device is running 208 | at a faster speed when the utility is activated. It is written by 209 | Neil Bridges and can be found on www.palmgear.com. 210 | 211 | The best games for use with Liberty are RPG, adventure and strategy 212 | games like Pokemon, Monopoly, Final Fantasy etc. Liberty does not 213 | emulate games well that change the screen contents quickly, like 214 | action games, side scrollers etc. 215 | 216 | ---------------------------------------------------------------------------- 217 | 218 | 10. Why is there no sound in Liberty? 219 | 220 | The GameBoy(tm) uses 4-channel with stereo sound. It is not possible 221 | to reproduce the sound within Liberty without having a significant 222 | impact on execution performance. 223 | 224 | UPDATE: (1.2+) partial sound support: only channels 1 and 2. 225 | . it can be more annoying than useful, and can be disabled :) 226 | 227 | ---------------------------------------------------------------------------- 228 | 229 | 11. Why am I getting errors for saving and loading of games? 230 | 231 | Liberty performs a number of checks when doing a save and restore of 232 | a emulation state and can run into a number of problems when trying 233 | to save or restore a game. The error can be caused because: 234 | 235 | - using an non-compatible saved state (from an earlier version) 236 | - low on memory and cannot perform the save 237 | - a writing error occured when saving the game state 238 | 239 | We have considered being backward compatible, however, each release 240 | of Liberty introduces either new attributes or a slight redesign of 241 | the internal mechanisms of the emulator. It would be a developer 242 | nightmare to try and translate between existing states. In the event 243 | something goes wrong, you will be informed, and the problematic 244 | saved state will be removed. There can be times where errors can 245 | occur for different reasons, and you should report any errors you 246 | experience to us - it could be a *bug* :) 247 | 248 | ---------------------------------------------------------------------------- 249 | 250 | 12. Why does beaming of ROM images not work? 251 | 252 | The Palm OS exchange manager (infa-red) is designed to work with the 253 | timing of a 16Mhz or 20Mhz processor [depending on device]. The use 254 | of an overclocking utility may interfere with the exchange manager 255 | and cause problems with beaming. 256 | 257 | If you are having problems with beaming ROM images, try disabling the 258 | overlocking utility and try again. 259 | 260 | ---------------------------------------------------------------------------- 261 | 262 | 13. How can I purchase Liberty? 263 | 264 | Liberty is available online exclusively from the PalmGearHQ website. 265 | You can purchase it by clicking on the "buy" icon at the following 266 | website: 267 | 268 | http://www.palmgear.com/software/showsoftware.cfm?prodID=7928 269 | 270 | PalmGearHQ handle credit card purchases both online and over the 271 | phone. If you do not have a credit card, you can send a cheque or 272 | money order (in US$) to the following address: 273 | 274 | Gambit Studios, LLC 275 | 220 North Thornton St. 276 | Richmond, MO 64085 277 | United States of America (USA) 278 | 279 | Pricing is as follows: 280 | 281 | $16.95 - Liberty 282 | $22.95 - Liberty + AfterBurner 3.0 BUNDLE 283 | 284 | Cash payment is considered as long as it is received at the above 285 | address, or paid in person [please allow a few days to process order] 286 | 287 | ---------------------------------------------------------------------------- 288 | 289 | 14. Who are the guys behind Liberty? 290 | 291 | Liberty was a joint effort between Aaron Ardiri and Michael Ethetton. 292 | 293 | Michael Ethetton is the president of Gambit Studios and wrote the z80 294 | and gameboy emulation core of the Liberty application. 295 | 296 | methetton@gambitstudios.com 297 | http://www.gambitstudios.com/ 298 | 299 | Aaron Ardiri, an Independent Palm Developer, joined the development 300 | team on invitation to get the product "out the door". His duties were 301 | to build an application framework, handle the memory management and 302 | build the user interface of the emulator. 303 | 304 | aaron@ardiri.com 305 | http://www.ardiri.com/ 306 | 307 | ---------------------------------------------------------------------------- 308 | 309 | If you have one of those questions that you feel we should provide some 310 | form of explanation of, please let us know and we can incorporate them 311 | into future versions of this FAQ. 312 | 313 | // Aaron Ardiri 314 | // Michael Ethetton 315 | - the Liberty development team 316 | 317 | ---------------------------------------------------------------------------- -------------------------------------------------------------------------------- /src/register.c: -------------------------------------------------------------------------------- 1 | /* 2 | * @(#)register.c 3 | * 4 | * Copyright 2000-2002, Aaron Ardiri (mailto:aaron@ardiri.com) 5 | * Michael Ethetton (mailto:methetton@gambitstudios.com) 6 | * All rights reserved. 7 | * 8 | * This file was generated as part of the "liberty" program developed for 9 | * the Palm Computing Platform designed by Palm: http://www.palm.com/ 10 | * 11 | * The contents of this file is confidential and proprietrary in nature 12 | * ("Confidential Information"). Redistribution or modification without 13 | * prior consent of the original author(s) is prohibited. 14 | * 15 | * NOTE: 16 | * The following portions of code found within this source code file are 17 | * owned exclusively by Michael Ethetton, and shall not be used in or 18 | * sold to other projects (internal or external) without the written 19 | * permission of Michael Ethetton. 20 | * 21 | * - z-80 CPU Emulation 22 | * - Nintendo Gameboy Emulation System 23 | * 24 | * The following portions of code found within this source code file are 25 | * owned exclusively by Aaron Ardiri, and shall not be used in or 26 | * sold to other projects (internal or external) without the written 27 | * permission of Aaron Ardiri. 28 | * 29 | * - GNU prc-tools 2.0 application framework 30 | * - Help System 31 | * - Device Configuration Module 32 | * - Multiple Code Segments Solution 33 | * 34 | * It shall be noted that Aaron Ardiri has licensed the above source code 35 | * and framework to Michael Ethetton for use only in the "liberty" project. 36 | */ 37 | 38 | #include "palm.h" 39 | 40 | // global variable structure 41 | typedef struct 42 | { 43 | MemHandle adjustGame; 44 | UInt16 adjustGameSize; 45 | Boolean demoMode; 46 | } RegisterGlobals; 47 | 48 | #ifdef USE_GLOBALS 49 | // globals object 50 | static RegisterGlobals gbls; 51 | static RegisterGlobals *globals; 52 | #endif 53 | 54 | typedef struct 55 | { 56 | UInt32 keyData; 57 | UInt8 keyValue; 58 | } KeyPreferencesType; 59 | 60 | /** 61 | * Initialize the registration routines. 62 | * 63 | * @param the global preferences structure. 64 | */ 65 | void 66 | RegisterInitialize(PreferencesType *prefs) 67 | { 68 | #ifndef USE_GLOBALS 69 | RegisterGlobals *globals; 70 | 71 | // create the globals object, and register it 72 | globals = (RegisterGlobals *)MemPtrNew(sizeof(RegisterGlobals)); 73 | FtrSet(appCreator, ftrRegisterGlobals, (UInt32)globals); 74 | #else 75 | globals = &gbls; 76 | #endif 77 | 78 | #ifdef PROTECTION_ON 79 | // 80 | // perform the registration check :)) 81 | // 82 | 83 | StrCopy(prefs->system.signature, "-HaCkMe-"); 84 | { 85 | MemHandle dataHandle; 86 | UInt8 *dataChunk; 87 | Int16 dataChunkSize; 88 | UInt8 *ptrCodeChunk; 89 | void (*regiLoader)(PreferencesType *); 90 | 91 | // extract the "encrypted" code 92 | dataHandle = DmGet1Resource('code', 0x0006); // code0006.bin 93 | dataChunk = (UInt8 *)MemHandleLock(dataHandle); 94 | dataChunkSize = MemHandleSize(dataHandle); 95 | ptrCodeChunk = (UInt8 *)MemPtrNew(dataChunkSize); 96 | MemMove(ptrCodeChunk, dataChunk, dataChunkSize); 97 | MemHandleUnlock(dataHandle); 98 | DmReleaseResource(dataHandle); 99 | 100 | // decrypt it 101 | RegisterDecryptChunk(ptrCodeChunk, dataChunkSize, 0x0002, 0x00); 102 | 103 | // execute the code chunk 104 | regiLoader = (void *)ptrCodeChunk; 105 | regiLoader(prefs); 106 | 107 | // we dont need the memory anymore, dispose of it 108 | MemPtrFree(ptrCodeChunk); 109 | } 110 | #else 111 | { 112 | StrCopy(prefs->system.signature, "|HaCkMe|"); 113 | _regiLoader(prefs); 114 | } 115 | #endif 116 | } 117 | 118 | /** 119 | * Display the "*UNREGISTERED*" message on the screen if needed. 120 | * 121 | * @param the global preferences structure. 122 | */ 123 | void 124 | RegisterShowMessage(PreferencesType *prefs) 125 | { 126 | const RectangleType rect = {{0,148},{160,14}}; 127 | const CustomPatternType erase = {0,0,0,0,0,0,0,0}; 128 | #ifndef USE_GLOBALS 129 | RegisterGlobals *globals; 130 | 131 | // get a globals reference 132 | FtrGet(appCreator, ftrRegisterGlobals, (UInt32 *)&globals); 133 | #endif 134 | 135 | // we MUST be on the main form to do this 136 | if (FrmGetActiveFormID() == mainForm) 137 | { 138 | Coord x; 139 | Char str[32]; 140 | 141 | // erase the are behind 142 | WinSetPattern(&erase); 143 | WinFillRectangle(&rect, 0); 144 | 145 | // draw our status 146 | StrCopy(str, (CHECK_SIGNATURE(prefs)) 147 | #ifdef LANG_de 148 | ? (globals->demoMode 149 | ? "- DEMO VERSION -" : "- REGISTRIERTE VERSION -") 150 | : "* NICHT REGISTRIERT *" // german 151 | #else 152 | #ifdef LANG_fr 153 | ? (globals->demoMode 154 | ? "- VERSION DE DEMO -" : "- VERSION ENREGISTRE -") 155 | : "* NON ENREGISTRE *" // generic 156 | 157 | #else 158 | #ifdef LANG_es 159 | ? (globals->demoMode 160 | ? "- VERSION DE DEMO -" : "- VERSION REGISTRADA -") 161 | : "* SIN REGISTRAR *" // generic 162 | 163 | #else 164 | ? (globals->demoMode 165 | ? "- DEMO VERSION -" : "- REGISTERED VERSION -") 166 | : "* UNREGISTERED *" // generic 167 | #endif 168 | #endif 169 | #endif 170 | ); 171 | x = (rect.extent.x - FntCharsWidth(str, StrLen(str))) >> 1; 172 | 173 | WinDrawChars(str, StrLen(str), x, rect.topLeft.y); 174 | } 175 | } 176 | 177 | /** 178 | * Adjust the game status that is "sensitive" to cracking 179 | * 180 | * @param prefs the global preferences type. 181 | * @param adjustType the adjustment definition. 182 | * @return true if the adjustment was performed, false otherwise. 183 | */ 184 | Boolean 185 | RegisterAdjustGame(PreferencesType *prefs, 186 | GameAdjustmentType *adjustType) 187 | { 188 | Boolean result = false; 189 | #ifndef USE_GLOBALS 190 | RegisterGlobals *globals; 191 | 192 | // get a globals reference 193 | FtrGet(appCreator, ftrRegisterGlobals, (UInt32 *)&globals); 194 | #endif 195 | 196 | // this stuff can only be done if the user is registered 197 | if (CHECK_SIGNATURE(prefs)) 198 | { 199 | Boolean (*adjustGame)(PreferencesType *, GameAdjustmentType *); 200 | 201 | // perform the 'adjustment' :) 202 | adjustGame = (void *)MemHandleLock(globals->adjustGame); 203 | result = adjustGame(prefs, adjustType); 204 | MemHandleUnlock(globals->adjustGame); 205 | } 206 | 207 | return result; 208 | } 209 | 210 | /** 211 | * Generate a checksum of a data chunk. 212 | * 213 | * @param dataChunk a pointer to the chunk of data to decrypt. 214 | * @param dataChunkSize the size of the chunk of data to decrypt. 215 | */ 216 | UInt8 217 | RegisterChecksum(UInt8 *dataChunk, 218 | UInt16 dataChunkSize) 219 | { 220 | UInt8 key; 221 | UInt16 i; 222 | 223 | // calculate a checksum of the data chunk 224 | key = 0; 225 | for (i=0; iadjustGame) 310 | MemHandleFree(globals->adjustGame); 311 | 312 | #ifndef USE_GLOBALS 313 | MemPtrFree(globals); 314 | 315 | // unregister global data 316 | FtrUnregister(appCreator, ftrRegisterGlobals); 317 | #endif 318 | } 319 | 320 | /** 321 | * Perform the necessary data adjustments and verify the existance 322 | * of a registered "keygen.pdb" file and set the registration flag 323 | * appropriately. 324 | * 325 | * @param prefs the global preferences type. 326 | */ 327 | void 328 | _regiLoader(PreferencesType *prefs) 329 | { 330 | #ifndef USE_GLOBALS 331 | RegisterGlobals *globals; 332 | 333 | // get a globals reference 334 | FtrGet(appCreator, ftrRegisterGlobals, (UInt32 *)&globals); 335 | #endif 336 | 337 | // lets assume there is no keygen.pdb file 338 | globals->adjustGame = NULL; 339 | globals->demoMode = false; 340 | 341 | #ifdef PROTECTION_ON 342 | { 343 | DmOpenRef keygenDB; 344 | 345 | // try and open the database 346 | keygenDB = DmOpenDatabaseByTypeCreator('_key',appCreator,dmModeReadOnly); 347 | if (keygenDB != NULL) 348 | { 349 | MemHandle recordH; 350 | UInt8 *recordChunk, key; 351 | UInt16 i, recordChunkSize; 352 | 353 | // get a reference to the first record 354 | recordH = DmGetRecord(keygenDB, 0); 355 | 356 | // process the record 357 | recordChunkSize = MemHandleSize(recordH); 358 | recordChunk = (UInt8 *)MemPtrNew(recordChunkSize); 359 | MemMove(recordChunk, MemHandleLock(recordH), recordChunkSize); 360 | MemHandleUnlock(recordH); 361 | 362 | // decrypt it (based on the @message file) 363 | key = 0; 364 | for (i=0; isystem.hotSyncUsername[i]; 366 | key = (key ^ 0xff) & 0xff; 367 | if (key == 0) key = 0x20; // key *cannot* be zero 368 | 369 | RegisterDecryptChunk(recordChunk, recordChunkSize, 0x0007, key); 370 | 371 | // extract the 'decryption' signature 372 | StrNCopy(prefs->system.signature, (Char *)recordChunk, 16); 373 | prefs->system.signature[15] = '\0'; 374 | 375 | // signature bad? lets try loading "@DEMO@" (key = 0x5A) keygen 376 | if (!CHECK_SIGNATURE(prefs)) 377 | { 378 | KeyPreferencesType *keyPrefs; 379 | UInt16 prefSize; 380 | Int16 flag; 381 | 382 | // allocate memory for preferences 383 | keyPrefs = (KeyPreferencesType *)MemPtrNew(sizeof(KeyPreferencesType)); 384 | 385 | // lets see how large the prefernces is (if it is there) 386 | prefSize = 0; 387 | flag = PrefGetAppPreferences(keyCreator, 0, NULL, &prefSize, true); 388 | 389 | // prefs available? 390 | if ((flag != noPreferenceFound) && 391 | (prefSize == sizeof(KeyPreferencesType))) 392 | { 393 | PrefGetAppPreferences(keyCreator, 0, keyPrefs, &prefSize, true); 394 | 395 | // validation check 396 | if ((keyPrefs->keyData == 0) && (keyPrefs->keyValue > 0)) 397 | keyPrefs->keyValue--; 398 | else 399 | keyPrefs->keyValue = 0; 400 | } 401 | 402 | // no prefs, initialize them 403 | else 404 | { 405 | keyPrefs->keyData = 0; 406 | keyPrefs->keyValue = 30; 407 | } 408 | 409 | // we "can" do it (not expired) 410 | if (keyPrefs->keyValue != 0) 411 | { 412 | MemMove(recordChunk, MemHandleLock(recordH), recordChunkSize); 413 | MemHandleUnlock(recordH); 414 | RegisterDecryptChunk(recordChunk, recordChunkSize, 0x0007, 0x5A); 415 | 416 | // extract the 'decryption' signature 417 | StrNCopy(prefs->system.signature, (Char *)recordChunk, 16); 418 | prefs->system.signature[15] = '\0'; 419 | 420 | // are we running in "DEMO" mode? 421 | globals->demoMode = (CHECK_SIGNATURE(prefs)); 422 | } 423 | 424 | // save the current settings 425 | prefSize = sizeof(KeyPreferencesType); 426 | PrefSetAppPreferences(keyCreator, 0, 1, keyPrefs, prefSize, true); 427 | MemPtrFree(keyPrefs); 428 | } 429 | 430 | // if the signature is good, lets configure everything we need 431 | if (CHECK_SIGNATURE(prefs)) 432 | { 433 | globals->adjustGameSize = recordChunkSize - 16; 434 | globals->adjustGame = MemHandleNew(globals->adjustGameSize); 435 | MemMove(MemHandleLock(globals->adjustGame), 436 | recordChunk+16, globals->adjustGameSize); 437 | MemHandleUnlock(globals->adjustGame); 438 | } 439 | 440 | // release the resource 441 | MemPtrFree(recordChunk); 442 | DmReleaseRecord(keygenDB, 0, false); 443 | 444 | DmCloseDatabase(keygenDB); 445 | } 446 | } 447 | #else 448 | { 449 | MemHandle codeH = DmGet1Resource('code', 0x0007); 450 | globals->adjustGameSize = MemHandleSize(codeH); 451 | globals->adjustGame = MemHandleNew(globals->adjustGameSize); 452 | MemMove(MemHandleLock(globals->adjustGame), 453 | MemHandleLock(codeH), globals->adjustGameSize); 454 | MemHandleUnlock(globals->adjustGame); 455 | MemHandleUnlock(codeH); 456 | } 457 | #endif 458 | } 459 | 460 | /** 461 | * Adjust the game status that is "sensitive" to cracking 462 | * 463 | * @param prefs the global preferences type. 464 | * @param adjustType the adjustment definition. 465 | * @return true if the adjustment was performed, false otherwise. 466 | */ 467 | Boolean 468 | _adjustGame(PreferencesType *prefs, 469 | GameAdjustmentType *adjustType) 470 | { 471 | Boolean result = true; 472 | 473 | // what task do we need to do? 474 | switch (adjustType->adjustMode) 475 | { 476 | case gameLoadROM: 477 | { 478 | UInt16 i; 479 | 480 | // load and lock X ROM chunks 481 | for (i=2; idata.loadROM.pageCount; i++) 482 | adjustType->data.loadROM.ptrPages[i] = 483 | (UInt8 *)MemHandleLock(DmGetResource(datType, i)); 484 | } 485 | break; 486 | 487 | case gameFreeROM: 488 | { 489 | UInt16 i; 490 | 491 | // unlock X ROM chunks 492 | for (i=2; idata.freeROM.pageCount; i++) 493 | MemPtrUnlock(adjustType->data.freeROM.ptrPages[i]); 494 | } 495 | break; 496 | 497 | default: 498 | result = false; 499 | break; 500 | } 501 | 502 | return result; 503 | } 504 | -------------------------------------------------------------------------------- /src/device.c: -------------------------------------------------------------------------------- 1 | /* 2 | * @(#)device.c 3 | * 4 | * Copyright 2000-2002, Aaron Ardiri (mailto:aaron@ardiri.com) 5 | * Michael Ethetton (mailto:methetton@gambitstudios.com) 6 | * All rights reserved. 7 | * 8 | * This file was generated as part of the "liberty" program developed for 9 | * the Palm Computing Platform designed by Palm: http://www.palm.com/ 10 | * 11 | * The contents of this file is confidential and proprietrary in nature 12 | * ("Confidential Information"). Redistribution or modification without 13 | * prior consent of the original author(s) is prohibited. 14 | * 15 | * NOTE: 16 | * The following portions of code found within this source code file are 17 | * owned exclusively by Michael Ethetton, and shall not be used in or 18 | * sold to other projects (internal or external) without the written 19 | * permission of Michael Ethetton. 20 | * 21 | * - z-80 CPU Emulation 22 | * - Nintendo Gameboy Emulation System 23 | * 24 | * The following portions of code found within this source code file are 25 | * owned exclusively by Aaron Ardiri, and shall not be used in or 26 | * sold to other projects (internal or external) without the written 27 | * permission of Aaron Ardiri. 28 | * 29 | * - GNU prc-tools 2.0 application framework 30 | * - Help System 31 | * - Device Configuration Module 32 | * - Multiple Code Segments Solution 33 | * 34 | * It shall be noted that Aaron Ardiri has licensed the above source code 35 | * and framework to Michael Ethetton for use only in the "liberty" project. 36 | */ 37 | 38 | #include "palm.h" 39 | 40 | // globals variable structure 41 | typedef struct 42 | { 43 | UInt32 romVersion; // the rom version of the device 44 | UInt32 depthState; // the screen depth state (old) 45 | 46 | #ifdef HANDERA 47 | struct 48 | { 49 | Boolean device; 50 | VgaScreenModeType scrMode; // current mode (scale, 1:1 etc) 51 | VgaRotateModeType scrRotate; // current display rotation 52 | } handera; 53 | #endif 54 | 55 | #ifdef SONY 56 | struct 57 | { 58 | Boolean device; 59 | UInt16 libRef; 60 | } sony; 61 | #endif 62 | 63 | } DeviceGlobals; 64 | 65 | #ifdef USE_GLOBALS 66 | // globals object 67 | static DeviceGlobals gbls; 68 | static DeviceGlobals *globals; 69 | #endif 70 | 71 | static Err DeviceBeamWriteProc(const void *, UInt32 *, void *) __DEVICE__; 72 | 73 | /** 74 | * Initialize the device. 75 | */ 76 | void 77 | DeviceInitialize() 78 | { 79 | #ifdef SONY 80 | Err err; 81 | #endif 82 | #ifdef HANDERA 83 | UInt32 trgVersion; 84 | #endif 85 | #ifndef USE_GLOBALS 86 | DeviceGlobals *globals; 87 | 88 | // create the globals objects, and register it 89 | globals = (DeviceGlobals *)MemPtrNew(sizeof(DeviceGlobals)); 90 | FtrSet(appCreator, ftrDeviceGlobals, (UInt32)globals); 91 | #else 92 | globals = &gbls; 93 | #endif 94 | 95 | // get the rom version for this device 96 | FtrGet(sysFtrCreator, sysFtrNumROMVersion, &globals->romVersion); 97 | 98 | // only OS 3.0 and above have > 1bpp display via API's 99 | if (DeviceSupportsVersion(romVersion3)) 100 | { 101 | UInt32 depth = 2; 102 | UInt32 *depthPtr; 103 | 104 | depthPtr = &depth; 105 | 106 | // save the current display state 107 | WinScreenMode(winScreenModeGet,NULL,NULL,&globals->depthState,NULL); 108 | 109 | // change into 2bpp display mode 110 | WinScreenMode(winScreenModeSet,NULL,NULL,depthPtr,NULL); 111 | 112 | #ifdef HANDERA 113 | globals->handera.device = 114 | (FtrGet(TRGSysFtrID, TRGVgaFtrNum, &trgVersion) != ftrErrNoSuchFeature); 115 | if (globals->handera.device) 116 | { 117 | VgaGetScreenMode(&globals->handera.scrMode, 118 | &globals->handera.scrRotate); 119 | VgaSetScreenMode(screenModeScaleToFit, rotateModeNone); 120 | } 121 | #endif 122 | 123 | #ifdef SONY 124 | err = SysLibFind(sonySysLibNameHR, &globals->sony.libRef); 125 | if (err != errNone) 126 | err = SysLibLoad('libr', sonySysFileCHRLib, &globals->sony.libRef); 127 | globals->sony.device = (err == errNone); 128 | 129 | // FORCE SONY INTO 160x160 scale 130 | if (globals->sony.device) 131 | { 132 | UInt32 width, height; 133 | 134 | width = 160; 135 | height = 160; 136 | 137 | // try to open the hires library 138 | err = HROpen(globals->sony.libRef); 139 | if (!err) 140 | 141 | // change into 160x160! 142 | HRWinScreenMode(globals->sony.libRef, winScreenModeSet, 143 | &width, &height, depthPtr, NULL); 144 | } 145 | #endif 146 | } 147 | } 148 | 149 | /** 150 | * Check the compatability status of the device we are working with. 151 | * 152 | * @return true if the device is supported, false otherwise. 153 | */ 154 | Boolean 155 | DeviceCheckCompatability() 156 | { 157 | Boolean result = true; 158 | 159 | // the device is only compatable if rom 3.0 or higher is available 160 | result = ( 161 | DeviceSupportsVersion(romVersion3) && 162 | ((DeviceGetSupportedDepths() & 0x02) != 0) 163 | ); 164 | 165 | // not compatable :( 166 | if (!result) 167 | { 168 | // display a incompatability dialog 169 | FormPtr form = FrmInitForm(deviForm); 170 | FrmDoDialog(form); 171 | FrmDeleteForm(form); 172 | 173 | // lets exit the application "gracefully" :> 174 | if (!DeviceSupportsVersion(romVersion2)) 175 | AppLaunchWithCommand(sysFileCDefaultApp,sysAppLaunchCmdNormalLaunch,NULL); 176 | } 177 | 178 | return result; 179 | } 180 | 181 | /** 182 | * Determine if the "DeviceGrayscale" routine is supported on the device. 183 | * 184 | * @return true if supported, false otherwise. 185 | */ 186 | Boolean 187 | DeviceSupportsGrayscale() 188 | { 189 | Boolean result = false; 190 | 191 | // only OS 3.0 and above have > 1bpp display via API's 192 | if (DeviceSupportsVersion(romVersion3)) 193 | { 194 | UInt32 cpuID; 195 | 196 | // get the processor ID 197 | FtrGet(sysFtrCreator, sysFtrNumProcessorID, &cpuID); 198 | cpuID = cpuID & sysFtrNumProcessorMask; 199 | 200 | // the "rules" for grayscale support 201 | result = ( 202 | (cpuID == sysFtrNumProcessor328) || 203 | (cpuID == sysFtrNumProcessorEZ) || 204 | (cpuID == sysFtrNumProcessorVZ) || 205 | (cpuID == sysFtrNumProcessorSuperVZ) 206 | ) && 207 | (DeviceGetSupportedDepths() < 0x80); // if 8bpp, color device :) 208 | } 209 | 210 | return result; 211 | } 212 | 213 | /** 214 | * Grayscale routine/settings for the device. 215 | * 216 | * @param mode the desired mode of operation. 217 | * @param lgray the lGray index (0..6) in intensity 218 | * @param dgray the dGray index (0..6) in intensity 219 | */ 220 | void 221 | DeviceGrayscale(UInt16 mode, 222 | UInt8 *lgray, 223 | UInt8 *dgray) 224 | { 225 | UInt32 cpuID; 226 | 227 | #define LGPMR1 ((unsigned char *)0xFFFFFA32) 228 | #define LGPMR2 ((unsigned char *)0xFFFFFA33) 229 | 230 | // get the processor ID 231 | FtrGet(sysFtrCreator, sysFtrNumProcessorID, &cpuID); 232 | switch (cpuID & sysFtrNumProcessorMask) 233 | { 234 | case sysFtrNumProcessor328: 235 | { 236 | UInt8 gray[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x07 }; 237 | 238 | switch (mode) 239 | { 240 | case grayGet: 241 | { 242 | UInt8 data; 243 | 244 | // light gray 245 | data = (UInt8)(((*LGPMR1) & 0xF0) >> 4); 246 | *lgray = 0; 247 | while (gray[*lgray] < data) 248 | (*lgray)++; 249 | 250 | // dark gray 251 | data = (UInt8)((*LGPMR2) & 0x0F); 252 | *dgray = 0; 253 | while (gray[*dgray] < data) 254 | (*dgray)++; 255 | } 256 | break; 257 | 258 | case graySet: 259 | *LGPMR1 = (gray[*lgray] << 4); 260 | *LGPMR2 = (0x70 | gray[*dgray]); 261 | break; 262 | 263 | default: 264 | break; 265 | } 266 | } 267 | break; 268 | 269 | case sysFtrNumProcessorEZ: 270 | case sysFtrNumProcessorVZ: 271 | case sysFtrNumProcessorSuperVZ: 272 | { 273 | UInt8 gray[] = { 0x00, 0x03, 0x04, 0x07, 0x0A, 0x0C, 0x0F }; 274 | 275 | switch (mode) 276 | { 277 | case grayGet: 278 | { 279 | UInt8 data; 280 | 281 | // light gray 282 | data = (UInt8)((*LGPMR2) & 0x0F); 283 | *lgray = 0; 284 | while (gray[*lgray] < data) 285 | (*lgray)++; 286 | 287 | // dark gray 288 | data = (UInt8)(((*LGPMR2) & 0xF0) >> 4); 289 | *dgray = 0; 290 | while (gray[*dgray] < data) 291 | (*dgray)++; 292 | } 293 | break; 294 | 295 | case graySet: 296 | *LGPMR2 = ((gray[*dgray] << 4) | gray[*lgray]); 297 | break; 298 | 299 | default: 300 | break; 301 | } 302 | } 303 | break; 304 | 305 | default: 306 | break; 307 | } 308 | } 309 | 310 | /** 311 | * Determine if the "DeviceGrayPalette" routine is supported on the device. 312 | * 313 | * @return true if supported, false otherwise. 314 | */ 315 | Boolean 316 | DeviceSupportsGrayPalette() 317 | { 318 | return (DeviceSupportsVersion(romVersion3_5)); 319 | } 320 | 321 | /** 322 | * Gray color palette routine/settings for the device. 323 | * 324 | * @param mode the desired mode of operation. 325 | * @param lgray the lGray RGB index (0..8) in intensity 326 | * @param dgray the dGray RGB index (0..8) in intensity 327 | */ 328 | void 329 | DeviceGrayPalette(UInt16 mode, 330 | UInt8 *lgray, 331 | UInt8 *dgray) 332 | { 333 | RGBColorType palette[] = { 334 | { 0, 0xff, 0xff, 0xff }, 335 | { 1, 0xc0, 0xc0, 0xc0 }, 336 | { 2, 0x80, 0x80, 0x80 }, 337 | { 3, 0x00, 0x00, 0x00 } 338 | }; 339 | UInt8 colorMapping[] = { 340 | 0x00, 0x20, 0x40, 341 | 0x60, 0x80, 0xA0, 342 | 0xC0, 0xE0, 0xff 343 | }; 344 | 345 | switch (mode) 346 | { 347 | case palGet: 348 | WinPalette(winPaletteGet, 0, 4, palette); 349 | { 350 | // light gray 351 | lgray[0] = lgray[1] = lgray[2] = 0; 352 | while (colorMapping[lgray[0]] < palette[1].r) { lgray[0]++; } 353 | while (colorMapping[lgray[1]] < palette[1].g) { lgray[1]++; } 354 | while (colorMapping[lgray[2]] < palette[1].b) { lgray[2]++; } 355 | 356 | // dark gray 357 | dgray[0] = dgray[1] = dgray[2] = 0; 358 | while (colorMapping[dgray[0]] < palette[2].r) { dgray[0]++; } 359 | while (colorMapping[dgray[1]] < palette[2].g) { dgray[1]++; } 360 | while (colorMapping[dgray[2]] < palette[2].b) { dgray[2]++; } 361 | } 362 | break; 363 | 364 | case palSet: 365 | { 366 | // light gray 367 | palette[1].r = colorMapping[lgray[0]]; 368 | palette[1].g = colorMapping[lgray[1]]; 369 | palette[1].b = colorMapping[lgray[2]]; 370 | 371 | // dark gray 372 | palette[2].r = colorMapping[dgray[0]]; 373 | palette[2].g = colorMapping[dgray[1]]; 374 | palette[2].b = colorMapping[dgray[2]]; 375 | } 376 | WinPalette(winPaletteSet, 0, 4, palette); 377 | break; 378 | 379 | case palReset: 380 | WinPalette(winPaletteSetToDefault, 0, 4, palette); 381 | break; 382 | 383 | default: 384 | break; 385 | } 386 | } 387 | 388 | /** 389 | * Get the supported depths the device can handle. 390 | * 391 | * @return the depths supported (1011b = 2^3 | 2^1 | 2^0 = 4,2,1 bpp). 392 | */ 393 | UInt32 394 | DeviceGetSupportedDepths() 395 | { 396 | UInt32 result = 0x00000001; 397 | 398 | // only OS 3.0 and above have > 1bpp display via API's 399 | if (DeviceSupportsVersion(romVersion3)) 400 | WinScreenMode(winScreenModeGetSupportedDepths,NULL,NULL,&result,NULL); 401 | 402 | return result; 403 | } 404 | 405 | /** 406 | * Check if the device is compatable with a particular ROM version. 407 | * 408 | * @param version the ROM version to compare against. 409 | * @return true if it is compatable, false otherwise. 410 | */ 411 | Boolean 412 | DeviceSupportsVersion(UInt32 version) 413 | { 414 | #ifndef USE_GLOBALS 415 | DeviceGlobals *globals; 416 | 417 | // get a globals reference 418 | FtrGet(appCreator, ftrDeviceGlobals, (UInt32 *)&globals); 419 | #endif 420 | 421 | return (globals->romVersion >= version); 422 | } 423 | 424 | /** 425 | * Determine the pointer to the bitmap data chunk for a specific window. 426 | * 427 | * @param win the window. 428 | * @return a pointer to the bitmap data chunk. 429 | */ 430 | void * 431 | DeviceWindowGetPointer(WinHandle win) 432 | { 433 | void *result = NULL; 434 | 435 | // palmos 3.5 - use BmpGetBits() 436 | if (DeviceSupportsVersion(romVersion3_5)) 437 | result = BmpGetBits(WinGetBitmap(win)); 438 | 439 | // palmos pre 3.5 - use standard technique 440 | else 441 | result = (void *)win->displayAddrV20; 442 | 443 | return result; 444 | } 445 | 446 | /** 447 | * Reset the device to its original state. 448 | */ 449 | void 450 | DeviceTerminate() 451 | { 452 | #ifndef USE_GLOBALS 453 | DeviceGlobals *globals; 454 | 455 | // get a globals reference 456 | FtrGet(appCreator, ftrDeviceGlobals, (UInt32 *)&globals); 457 | #endif 458 | 459 | // restore the current display state 460 | if (DeviceSupportsVersion(romVersion3)) 461 | WinScreenMode(winScreenModeSet,NULL,NULL,&globals->depthState,NULL); 462 | 463 | #ifdef HANDERA 464 | if (globals->handera.device) 465 | { 466 | VgaSetScreenMode(globals->handera.scrMode, 467 | globals->handera.scrRotate); 468 | } 469 | #endif 470 | 471 | #ifdef SONY 472 | if (globals->sony.device) 473 | { 474 | HRWinScreenMode(globals->sony.libRef, 475 | winScreenModeSetToDefaults, NULL, NULL, NULL, NULL); 476 | 477 | // close the hires library 478 | HRClose(globals->sony.libRef); 479 | } 480 | #endif 481 | 482 | #ifndef USE_GLOBALS 483 | // clean up 484 | MemPtrFree(globals); 485 | 486 | // unregister global data 487 | FtrUnregister(appCreator, ftrDeviceGlobals); 488 | #endif 489 | } 490 | 491 | /** 492 | * Send a database using the Exchange API (Beam). 493 | * 494 | * @param romName the rom file to beam. 495 | * @return true if successful, false otherwise. 496 | */ 497 | Boolean 498 | DeviceBeamDatabase(Char *romName) 499 | { 500 | Char dbName[32]; 501 | UInt16 card; 502 | LocalID dbID; 503 | Boolean result = true; 504 | 505 | // initialize 506 | StrPrintF(dbName, "Gmbt_%s", romName); 507 | card = 0; 508 | dbID = DmFindDatabase(card, dbName); 509 | if (dbID == NULL) 510 | { 511 | card = 1; 512 | dbID = DmFindDatabase(card, dbName); 513 | } 514 | 515 | // send over the database 516 | if (dbID != NULL) 517 | { 518 | ExgSocketType socket; 519 | Err err, e; 520 | Char strName[32]; 521 | UInt16 i; 522 | 523 | // we need to add the ".pdb" extension (so receiver knows what to do) 524 | StrPrintF(strName, "%s.pdb", dbName); 525 | for (i=0;i 21 | 22 | #define sonySysFileCSony 'SoNy' 23 | #define sonySysVfsCstmApiCreator sonySysFileCSony 24 | #define sonySysFileCSystem 'SsYs' 25 | 26 | #define sonySysFileCHRLib 'SlHr' 27 | #define sonySysFileTHRLib sysFileTLibrary 28 | #define sonySysLibNameHR "Sony HR Library" 29 | 30 | // error code 31 | #define sonyErrorClass (oemErrorClass) 32 | #define sonyHRErrorClass (sonyErrorClass | 0x200) 33 | 34 | // BUILDING_APPLICATION 35 | #if BUILDING_APP_OR_LIB_HIGH_RES 36 | // direct link to library code 37 | #define HR_TRAP(trapNum) 38 | #else 39 | // else someone else is including this public header file; use traps 40 | #define HR_TRAP(trapNum) SYS_TRAP(trapNum) 41 | #endif 42 | 43 | /******************************************************************** 44 | * define SCREEN SIZE 45 | ********************************************************************/ 46 | 47 | #define hrWidth 320 48 | #define hrHeight 320 49 | #define stdWidth 160 50 | #define stdHeight 160 51 | 52 | /******************************************************************** 53 | * define hrErrorClass 54 | ********************************************************************/ 55 | 56 | #define hrErrNone 0 57 | #define hrErrorClass (sonyHRErrorClass) 58 | #define hrErrParam (hrErrorClass | 1) 59 | #define hrErrNotOpen (hrErrorClass | 2) 60 | #define hrErrStillOpen (hrErrorClass | 3) 61 | #define hrErrNoGlobals (hrErrorClass | 4) 62 | #define hrErrMemory (hrErrorClass | 5) 63 | #define hrErrNoFeature (hrErrorClass | 6) 64 | 65 | /******************************************************************** 66 | * define High Resolution Font 67 | ********************************************************************/ 68 | 69 | enum hrFontID 70 | { 71 | hrTinyFont = 0x00, 72 | hrTinyBoldFont, 73 | hrSmallFont, 74 | hrSmallSymbolFont, 75 | hrSmallSymbol11Font, 76 | hrSmallSymbol7Font, 77 | hrSmallLedFont, 78 | hrSmallBoldFont, 79 | hrStdFont, 80 | hrBoldFont, 81 | hrLargeFont, 82 | hrSymbolFont, 83 | hrSymbol11Font, 84 | hrSymbol7Font, 85 | hrLedFont, 86 | hrLargeBoldFont, 87 | hrFntAppFontCustomBase = 0x80 88 | }; 89 | typedef enum hrFontID HRFontID; 90 | 91 | /******************************************************************** 92 | * define HRTrapNumEnum 93 | ********************************************************************/ 94 | 95 | #ifdef __GNUC__ 96 | 97 | #define HRTrapGetAPIVersion sysLibTrapCustom 98 | #define HRTrapWinClipRectangle sysLibTrapCustom+1 99 | #define HRTrapWinCopyRectangle sysLibTrapCustom+2 100 | #define HRTrapWinCreateBitmapWindow sysLibTrapCustom+3 101 | #define HRTrapWinCreateOffscreenWindow sysLibTrapCustom+4 102 | #define HRTrapWinCreateWindow sysLibTrapCustom+5 103 | #define HRTrapWinDisplayToWindowPt sysLibTrapCustom+6 104 | #define HRTrapWinDrawBitmap sysLibTrapCustom+7 105 | #define HRTrapWinDrawChar sysLibTrapCustom+8 106 | #define HRTrapWinDrawChars sysLibTrapCustom+9 107 | #define HRTrapWinDrawGrayLine sysLibTrapCustom+10 108 | #define HRTrapWinDrawGrayRectangleFrame sysLibTrapCustom+11 109 | #define HRTrapWinDrawInvertedChars sysLibTrapCustom+12 110 | #define HRTrapWinDrawLine sysLibTrapCustom+13 111 | #define HRTrapWinDrawPixel sysLibTrapCustom+14 112 | #define HRTrapWinDrawRectangle sysLibTrapCustom+15 113 | #define HRTrapWinDrawRectangleFrame sysLibTrapCustom+16 114 | #define HRTrapWinDrawTruncChars sysLibTrapCustom+17 115 | #define HRTrapWinEraseChars sysLibTrapCustom+18 116 | #define HRTrapWinEraseLine sysLibTrapCustom+19 117 | #define HRTrapWinErasePixel sysLibTrapCustom+20 118 | #define HRTrapWinEraseRectangle sysLibTrapCustom+21 119 | #define HRTrapWinEraseRectangleFrame sysLibTrapCustom+22 120 | #define HRTrapWinFillLine sysLibTrapCustom+23 121 | #define HRTrapWinFillRectangle sysLibTrapCustom+24 122 | #define HRTrapWinGetClip sysLibTrapCustom+25 123 | #define HRTrapWinGetDisplayExtent sysLibTrapCustom+26 124 | #define HRTrapWinGetFramesRectangle sysLibTrapCustom+27 125 | #define HRTrapWinGetPixel sysLibTrapCustom+28 126 | #define HRTrapWinGetWindowBounds sysLibTrapCustom+29 127 | #define HRTrapWinGetWindowExtent sysLibTrapCustom+30 128 | #define HRTrapWinGetWindowFrameRect sysLibTrapCustom+31 129 | #define HRTrapWinInvertChars sysLibTrapCustom+32 130 | #define HRTrapWinInvertLine sysLibTrapCustom+33 131 | #define HRTrapWinInvertPixel sysLibTrapCustom+34 132 | #define HRTrapWinInvertRectangle sysLibTrapCustom+35 133 | #define HRTrapWinInvertRectangleFrame sysLibTrapCustom+36 134 | #define HRTrapWinPaintBitmap sysLibTrapCustom+37 135 | #define HRTrapWinPaintChar sysLibTrapCustom+38 136 | #define HRTrapWinPaintChars sysLibTrapCustom+39 137 | #define HRTrapWinPaintLine sysLibTrapCustom+40 138 | #define HRTrapWinPaintLines sysLibTrapCustom+41 139 | #define HRTrapWinPaintPixel sysLibTrapCustom+42 140 | #define HRTrapWinPaintPixels sysLibTrapCustom+43 141 | #define HRTrapWinPaintRectangle sysLibTrapCustom+44 142 | #define HRTrapWinPaintRectangleFrame sysLibTrapCustom+45 143 | #define HRTrapWinRestoreBits sysLibTrapCustom+46 144 | #define HRTrapWinSaveBits sysLibTrapCustom+47 145 | #define HRTrapWinScreenMode sysLibTrapCustom+48 146 | #define HRTrapWinScrollRectangle sysLibTrapCustom+49 147 | #define HRTrapWinSetClip sysLibTrapCustom+50 148 | #define HRTrapWinSetWindowBounds sysLibTrapCustom+51 149 | #define HRTrapWinWindowToDisplayPt sysLibTrapCustom+52 150 | #define HRTrapBmpBitsSize sysLibTrapCustom+53 151 | #define HRTrapBmpSize sysLibTrapCustom+54 152 | #define HRTrapBmpCreate sysLibTrapCustom+55 153 | #define HRTrapFntGetFont sysLibTrapCustom+56 154 | #define HRTrapFntSetFont sysLibTrapCustom+57 155 | #define HRTrapFontSelect sysLibTrapCustom+58 156 | #define HRTrapSystem sysLibTrapCustom+59 157 | #define HRTrapWinGetPixelRGB sysLibTrapCustom+60 158 | #define HRTrapGetInfo sysLibTrapCustom+61 159 | 160 | #else 161 | 162 | typedef enum tagHRTrapNumEnum 163 | { 164 | HRTrapGetAPIVersion = sysLibTrapCustom, 165 | HRTrapWinClipRectangle, 166 | HRTrapWinCopyRectangle, 167 | HRTrapWinCreateBitmapWindow, 168 | HRTrapWinCreateOffscreenWindow, 169 | HRTrapWinCreateWindow, 170 | HRTrapWinDisplayToWindowPt, 171 | HRTrapWinDrawBitmap, 172 | HRTrapWinDrawChar, 173 | HRTrapWinDrawChars, 174 | HRTrapWinDrawGrayLine, 175 | HRTrapWinDrawGrayRectangleFrame, 176 | HRTrapWinDrawInvertedChars, 177 | HRTrapWinDrawLine, 178 | HRTrapWinDrawPixel, 179 | HRTrapWinDrawRectangle, 180 | HRTrapWinDrawRectangleFrame, 181 | HRTrapWinDrawTruncChars, 182 | HRTrapWinEraseChars, 183 | HRTrapWinEraseLine, 184 | HRTrapWinErasePixel, 185 | HRTrapWinEraseRectangle, 186 | HRTrapWinEraseRectangleFrame, 187 | HRTrapWinFillLine, 188 | HRTrapWinFillRectangle, 189 | HRTrapWinGetClip, 190 | HRTrapWinGetDisplayExtent, 191 | HRTrapWinGetFramesRectangle, 192 | HRTrapWinGetPixel, 193 | HRTrapWinGetWindowBounds, 194 | HRTrapWinGetWindowExtent, 195 | HRTrapWinGetWindowFrameRect, 196 | HRTrapWinInvertChars, 197 | HRTrapWinInvertLine, 198 | HRTrapWinInvertPixel, 199 | HRTrapWinInvertRectangle, 200 | HRTrapWinInvertRectangleFrame, 201 | HRTrapWinPaintBitmap, 202 | HRTrapWinPaintChar, 203 | HRTrapWinPaintChars, 204 | HRTrapWinPaintLine, 205 | HRTrapWinPaintLines, 206 | HRTrapWinPaintPixel, 207 | HRTrapWinPaintPixels, 208 | HRTrapWinPaintRectangle, 209 | HRTrapWinPaintRectangleFrame, 210 | HRTrapWinRestoreBits, 211 | HRTrapWinSaveBits, 212 | HRTrapWinScreenMode, 213 | HRTrapWinScrollRectangle, 214 | HRTrapWinSetClip, 215 | HRTrapWinSetWindowBounds, 216 | HRTrapWinWindowToDisplayPt, 217 | HRTrapBmpBitsSize, 218 | HRTrapBmpSize, 219 | HRTrapBmpCreate, 220 | HRTrapFntGetFont, 221 | HRTrapFntSetFont, 222 | HRTrapFontSelect, 223 | HRTrapSystem, 224 | HRTrapWinGetPixelRGB, 225 | HRTrapGetInfo 226 | } HRTrapNumEnum; 227 | 228 | #endif 229 | 230 | /******************************************************************** 231 | * API Prototypes 232 | ********************************************************************/ 233 | 234 | #ifdef __cplusplus 235 | extern "C" { 236 | #endif 237 | 238 | /******************************************************************** 239 | * Standard library open, close, sleep and wake functions 240 | ********************************************************************/ 241 | 242 | extern Err HROpen(UInt16 refNum) HR_TRAP(sysLibTrapOpen); 243 | 244 | extern Err HRClose(UInt16 refNum) HR_TRAP(sysLibTrapClose); 245 | 246 | extern Err HRSleep(UInt16 refNum) HR_TRAP(sysLibTrapSleep); 247 | 248 | extern Err HRWake(UInt16 refNum) HR_TRAP(sysLibTrapWake); 249 | 250 | 251 | /******************************************************************** 252 | * Custom library API functions 253 | ********************************************************************/ 254 | 255 | extern Err HRGetAPIVersion(UInt16 refNum, UInt16 *versionP) 256 | HR_TRAP(HRTrapGetAPIVersion); 257 | 258 | extern void HRWinClipRectangle(UInt16 refNum, RectangleType *rP) 259 | HR_TRAP(HRTrapWinClipRectangle); 260 | 261 | extern void HRWinCopyRectangle(UInt16 refNum, WinHandle srcWin, WinHandle dstWin, RectangleType *srcRect, Coord destX, Coord destY, WinDrawOperation mode) 262 | HR_TRAP(HRTrapWinCopyRectangle); 263 | 264 | extern WinHandle HRWinCreateBitmapWindow(UInt16 refNum, BitmapType *bitmapP, UInt16 *error) 265 | HR_TRAP(HRTrapWinCreateBitmapWindow); 266 | 267 | extern WinHandle HRWinCreateOffscreenWindow(UInt16 refNum, Coord width, Coord height, WindowFormatType format, UInt16 *error) 268 | HR_TRAP(HRTrapWinCreateOffscreenWindow); 269 | 270 | extern WinHandle HRWinCreateWindow(UInt16 refNum, RectangleType *bounds, FrameType frame, Boolean modal, Boolean focusable, UInt16 *error) 271 | HR_TRAP(HRTrapWinCreateWindow); 272 | 273 | extern void HRWinDisplayToWindowPt(UInt16 refNum, Coord *extentX, Coord *extentY) 274 | HR_TRAP(HRTrapWinDisplayToWindowPt); 275 | 276 | extern void HRWinDrawBitmap(UInt16 refNum, BitmapPtr bitmapP, Coord x, Coord Y) 277 | HR_TRAP(HRTrapWinDrawBitmap); 278 | 279 | extern void HRWinDrawChar(UInt16 refNum, WChar theChar, Coord x, Coord Y) 280 | HR_TRAP(HRTrapWinDrawChar); 281 | 282 | extern void HRWinDrawChars(UInt16 refNum, const Char *chars, Int16 len, Coord x, Coord y) 283 | HR_TRAP(HRTrapWinDrawChars); 284 | 285 | extern void HRWinDrawGrayLine(UInt16 refNum, Coord x1, Coord y1, Coord x2, Coord y2) 286 | HR_TRAP(HRTrapWinDrawGrayLine); 287 | 288 | extern void HRWinDrawGrayRectangleFrame(UInt16 refNum, FrameType frame, RectangleType *rP) 289 | HR_TRAP(HRTrapWinDrawGrayRectangleFrame); 290 | 291 | extern void HRWinDrawInvertedChars(UInt16 refNum, const Char *chars, Int16 len, Coord x, Coord y) 292 | HR_TRAP(HRTrapWinDrawInvertedChars); 293 | 294 | extern void HRWinDrawLine(UInt16 refNum, Coord x1, Coord y1, Coord x2, Coord y2) 295 | HR_TRAP(HRTrapWinDrawLine); 296 | 297 | extern void HRWinDrawPixel(UInt16 refNum, Coord x, Coord y) 298 | HR_TRAP(HRTrapWinDrawPixel); 299 | 300 | extern void HRWinDrawRectangle(UInt16 refNum, RectangleType *rP, UInt16 cornerDiam) 301 | HR_TRAP(HRTrapWinDrawRectangle); 302 | 303 | extern void HRWinDrawRectangleFrame(UInt16 refNum, FrameType frame, RectangleType *rP) 304 | HR_TRAP(HRTrapWinDrawRectangleFrame); 305 | 306 | extern void HRWinDrawTruncChars(UInt16 refNum, const Char *chars, Int16 len, Coord x, Coord y, Coord maxWidth) 307 | HR_TRAP(HRTrapWinDrawTruncChars); 308 | 309 | extern void HRWinEraseChars(UInt16 refNum, const Char *chars, Int16 len, Coord x, Coord y) 310 | HR_TRAP(HRTrapWinEraseChars); 311 | 312 | extern void HRWinEraseLine(UInt16 refNum, Coord x1, Coord y1, Coord x2, Coord y2) 313 | HR_TRAP(HRTrapWinEraseLine); 314 | 315 | extern void HRWinErasePixel(UInt16 refNum, Coord x, Coord y) 316 | HR_TRAP(HRTrapWinErasePixel); 317 | 318 | extern void HRWinEraseRectangle(UInt16 refNum, RectangleType *rP, UInt16 cornerDiam) 319 | HR_TRAP(HRTrapWinEraseRectangle); 320 | 321 | extern void HRWinEraseRectangleFrame(UInt16 refNum, FrameType frame, RectangleType *rP) 322 | HR_TRAP(HRTrapWinEraseRectangleFrame); 323 | 324 | extern void HRWinFillLine(UInt16 refNum, Coord x1, Coord y1, Coord x2, Coord y2) 325 | HR_TRAP(HRTrapWinFillLine); 326 | 327 | extern void HRWinFillRectangle(UInt16 refNum, RectangleType *rP, UInt16 cornerDiam) 328 | HR_TRAP(HRTrapWinFillRectangle); 329 | 330 | extern void HRWinGetClip(UInt16 refNum, RectangleType *rP) 331 | HR_TRAP(HRTrapWinGetClip); 332 | 333 | extern void HRWinGetDisplayExtent(UInt16 refNum, Coord *extentX, Coord *extentY) 334 | HR_TRAP(HRTrapWinGetDisplayExtent); 335 | 336 | extern void HRWinGetFramesRectangle(UInt16 refNum, FrameType frame, RectangleType *rP, RectangleType *obscuredRectP) 337 | HR_TRAP(HRTrapWinGetFramesRectangle); 338 | 339 | extern IndexedColorType HRWinGetPixel(UInt16 refNum, Coord x, Coord y) 340 | HR_TRAP(HRTrapWinGetPixel); 341 | 342 | extern void HRWinGetWindowBounds(UInt16 refNum, RectangleType *rP) 343 | HR_TRAP(HRTrapWinGetWindowBounds); 344 | 345 | extern void HRWinGetWindowExtent(UInt16 refNum, Coord *extentX, Coord *extentY) 346 | HR_TRAP(HRTrapWinGetWindowExtent); 347 | 348 | extern void HRWinGetWindowFrameRect(UInt16 refNum, WinHandle winHandle, RectangleType *rP) 349 | HR_TRAP(HRTrapWinGetWindowFrameRect); 350 | 351 | extern void HRWinInvertChars(UInt16 refNum, const Char *chars, Int16 len, Coord x, Coord y) 352 | HR_TRAP(HRTrapWinInvertChars); 353 | 354 | extern void HRWinInvertLine(UInt16 refNum, Coord x1, Coord y1, Coord x2, Coord y2) 355 | HR_TRAP(HRTrapWinInvertLine); 356 | 357 | extern void HRWinInvertPixel(UInt16 refNum, Coord x, Coord y) 358 | HR_TRAP(HRTrapWinInvertPixel); 359 | 360 | extern void HRWinInvertRectangle(UInt16 refNum, RectangleType *rP, UInt16 cornerDiam) 361 | HR_TRAP(HRTrapWinInvertRectangle); 362 | 363 | extern void HRWinInvertRectangleFrame(UInt16 refNum, FrameType frame, RectangleType *rP) 364 | HR_TRAP(HRTrapWinInvertRectangleFrame); 365 | 366 | extern void HRWinPaintBitmap(UInt16 refNum, BitmapType *bitmapP, Coord x, Coord y) 367 | HR_TRAP(HRTrapWinPaintBitmap); 368 | 369 | extern void HRWinPaintChar(UInt16 refNum, WChar theChar, Coord x, Coord y) 370 | HR_TRAP(HRTrapWinPaintChar); 371 | 372 | extern void HRWinPaintChars(UInt16 refNum, const Char *chars, Int16 len, Coord x, Coord y) 373 | HR_TRAP(HRTrapWinPaintChars); 374 | 375 | extern void HRWinPaintLine(UInt16 refNum, Coord x1, Coord y1, Coord x2, Coord y2) 376 | HR_TRAP(HRTrapWinPaintLine); 377 | 378 | extern void HRWinPaintLines(UInt16 refNum, UInt16 numLines, WinLineType lines[]) 379 | HR_TRAP(HRTrapWinPaintLines); 380 | 381 | extern void HRWinPaintPixel(UInt16 refNum, Coord x, Coord y) 382 | HR_TRAP(HRTrapWinPaintPixel); 383 | 384 | extern void HRWinPaintPixels(UInt16 refNum, UInt16 numPoints, PointType pts[]) 385 | HR_TRAP(HRTrapWinPaintPixels); 386 | 387 | extern void HRWinPaintRectangle(UInt16 refNum, RectangleType *rP, UInt16 cornerDiam) 388 | HR_TRAP(HRTrapWinPaintRectangle); 389 | 390 | extern void HRWinPaintRectangleFrame(UInt16 refNum, FrameType frame, RectangleType *rP) 391 | HR_TRAP(HRTrapWinPaintRectangleFrame); 392 | 393 | extern void HRWinRestoreBits(UInt16 refNum, WinHandle winHandle, Coord destX, Coord destY) 394 | HR_TRAP(HRTrapWinRestoreBits); 395 | 396 | extern WinHandle HRWinSaveBits(UInt16 refNum, RectangleType *sourceP, UInt16 *error) 397 | HR_TRAP(HRTrapWinSaveBits); 398 | 399 | extern Err HRWinScreenMode(UInt16 refNum, WinScreenModeOperation operation, UInt32 *widthP, UInt32 *heightP, UInt32 *depthP, Boolean *enableColorP) 400 | HR_TRAP(HRTrapWinScreenMode); 401 | 402 | extern void HRWinScrollRectangle(UInt16 refNum, RectangleType *rP, WinDirectionType direction, Coord distance, RectangleType *vacatedP) 403 | HR_TRAP(HRTrapWinScrollRectangle); 404 | 405 | extern void HRWinSetClip(UInt16 refNum, RectangleType *rP) 406 | HR_TRAP(HRTrapWinSetClip); 407 | 408 | extern void HRWinSetWindowBounds(UInt16 refNum, WinHandle winHandle, RectangleType *rP) 409 | HR_TRAP(HRTrapWinSetWindowBounds); 410 | 411 | extern void HRWinWindowToDisplayPt(UInt16 refNum, Coord *extentX, Coord *extentY) 412 | HR_TRAP(HRTrapWinWindowToDisplayPt); 413 | 414 | extern Err HRWinGetPixelRGB(UInt16 refNum, Coord x, Coord y, RGBColorType *rgbP) 415 | HR_TRAP(HRTrapWinGetPixelRGB); 416 | 417 | 418 | 419 | extern UInt32 HRBmpBitsSize(UInt16 refNum, BitmapType *bitmapP) 420 | HR_TRAP(HRTrapBmpBitsSize); 421 | 422 | extern UInt32 HRBmpSize(UInt16 refNum, BitmapType *bitmapP) 423 | HR_TRAP(HRTrapBmpSize); 424 | 425 | extern BitmapType *HRBmpCreate(UInt16 refNum, Coord width, Coord height, UInt8 depth, ColorTableType *colortableP, UInt16 *error) 426 | HR_TRAP( HRTrapBmpCreate); 427 | 428 | 429 | 430 | extern HRFontID HRFntGetFont(UInt16 refNum) 431 | HR_TRAP(HRTrapFntGetFont); 432 | 433 | extern HRFontID HRFntSetFont(UInt16 refNum, HRFontID font) 434 | HR_TRAP(HRTrapFntSetFont); 435 | 436 | extern HRFontID HRFontSelect(UInt16 refNum, HRFontID font) 437 | HR_TRAP(HRTrapFontSelect); 438 | 439 | 440 | /* System Use Only */ 441 | extern Err HRSystem(UInt16 refNum, UInt16 operation, UInt32 *param1, UInt32 *param2, UInt32 *param3) 442 | HR_TRAP(HRTrapSystem); 443 | 444 | extern Err HRGetInfo(UInt16 refNum, UInt16 *ptr1, UInt16 *ptr2) 445 | HR_TRAP(HRTrapGetInfo); 446 | 447 | /** Number of API : 66 **/ 448 | 449 | #ifdef __cplusplus 450 | } 451 | #endif 452 | 453 | #endif /* __SONYHIGHRESLINB_H__ */ 454 | --------------------------------------------------------------------------------