diff --git a/build.txt b/build.txt new file mode 100644 index 0000000000..ef102755b4 --- /dev/null +++ b/build.txt @@ -0,0 +1,242 @@ +Most programs in the repository are regularly and automatically compiled +by the autobuild server, compiled binaries are available at +http://builds.kolibrios.org. The autobuild server uses the build system Tup, +data for it are located in files named Tupfile.lua over the repository. + +------------------------------------------------------------------------------- + +Q1. I want to build one program and I don't want to know anything about Tup. +Q2. I want to build one program using Tup. +Q3. I want to add a program to the autobuild. +Q4. I want to build the entire system. +Q5. I'm sure that I want to build the entire system. + The autobuild server does this, after all. +Q6. I don't want to keep a zoo of compilers and tools required for Q5, + but I still want to build as many programs as possible with what I have. + +------------------------------------------------------------------------------- + +Q1. I want to build one program and I don't want to know anything about Tup. +A1. Fine. You will need a corresponding compiler, obviously. + + * For a FASM program, get FASM at http://flatassembler.net/download.php. + To compile, find the main .asm file of the program and run + path/to/fasm + The compiler will automatically select the name for output, using + base name of input and extension based on file format. Though, you can + give also output name explicitly, as the second argument. + + If the compiler produces an error "file not found" regarding 'lang.inc', + the program can be compiled using different languages of interface. + Create a file 'lang.inc' in the same folder as like follows: + lang fix en + Here the last word selects the language. Valid languages are + en, ru, et, it, sp. Not all programs provide all translations, + en should always be available, ru is the most frequent after en. + + * For a NASM program, get NASM at http://www.nasm.us/. + To compile, find the main .asm file of the program and run + path/to/nasm -f bin -o + Multi-language is rarely supported in this category, but you could still + see sometimes an error "file not found" regarding 'lang_nasm.inc'. If so, + create a file 'lang_nasm.inc' in the same folder as like follows: + %define lang 'en' + Read the entry about fasm for description of valid languages. + + * For a c-- program, try to avoid compiling it and instead rewrite the code + in a normal language like assembler or C. If you absolutely need + to compile, note that the compiler has been abandoned long ago, so + don't look for an official site. It is possible to find the compiler + somewhere on http://board.kolibrios.org, but be prepared to several tries + because there are several slightly different compiler versions, not all of + which are able to build all programs. + There is no Linux version, but Windows version runs fine under Wine. + + * For a GCC program, get the toolchain at + http://ftp.kolibrios.org/users/Serge/new/Toolchain/. + + Under Windows, you need the package with "msys" in name and MinGW; + after installing MinGW, unpack the package to + \MinGW\msys\1.0\home\autobuild\tools\win32, the package assumes + exactly this path. Run MinGW shell. + + Under Linux, you need the package with "linux" in name + and runtime library cloog; e.g. for Debian-based distributives + use apt-get install libcloog-isl4. Unpack the package to + /home/autobuild/tools/win32, the package assumes exactly this path. + + In both MinGW and Linux, make sure that the command + /home/autobuild/tools/win32/bin/kos32-gcc + invokes the compiler. + + If the program uses libraries, you will also need to either compile + them separately or download SDK, if they are included to SDK. + Compiling is ultimately a sequence of calls to kos32-gcc and kos32-ld, + but filling exact parameters can be tricky, so maybe you want to + use Tup - proceed to Q2/A2 - or Make, if a maintainer has provided + Makefile. + + * For a MSVC program, get the compiler as a part of Visual Studio, + Express Edition is fine, or as a part of Windows SDK. + For obvious reasons, there is no Linux version, but the compiler runs file + under Wine. + + If the program uses libraries, you will also need to either compile + them separately or download SDK, if they are included to SDK. + Compiling is ultimately a sequence of calls to cl.exe and link.exe, + but filling exact parameters can be tricky, so maybe you want to + use Tup - proceed to Q2/A2 - or Make, if a maintainer has provided + Makefile. + + * For any language, if the program is KolibriOS binary, the compiled binary + can optionally be compiled with kpack. Windows version of kpack + can be downloaded at http://diamond.kolibrios.org/prg/kpack.exe, + Linux version can be compiled from sources at + (repository)/programs/other/kpack/linux. + + * The kernel can optionally be compiled with kerpack. + Linux version can be compiled from sources at + (repository)/programs/other/kpack/kerpack_linux. + There is no Windows version. + +Q2. I want to build one program using Tup. +A2. You will still need the corresponding compiler as described in Q1/A1. + You will also need Tup, get it at http://gittup.org/tup/index.html. + Make sure that the corresponding compiler is somewhere in PATH + and can be invoked without explicit path. For Linux, note that + all programs are invoked without extension, like + fasm + or + kos32-gcc + with one exception: MSVC linker is invoked as link.exe to avoid conflict + with link from coreutils. Under Linux, c--, cl, link.exe should be scripts + invoking Wine with the corresponding binary. The interaction tup+wine + does not work by default; ultimately, invoking scripts should be like: + c--: WINEDEBUG=-all LD_PRELOAD=/path/to/nosetsid.so /path/to/wine /path/to/C--.exe $* + cl: WINEDEBUG=-all LD_PRELOAD=/path/to/nosetsid.so /path/to/wine /path/to/cl.exe -I/path/to/cl/include $* + link.exe: WINEDEBUG=-all LD_PRELOAD=/path/to/nosetsid.so /path/to/wine /path/to/link.exe $* + where nosetsid.so is compiled as a 32-bit shared library + from C file with one line "int setsid() { return -1; }". + + If the program does not use any libraries, run + tup init + in the directory with the program. Then, + tup + without arguments will build the program with default settings. + Subsequent runs will not do anything unless any file that was used + during the compilation - not necessarily the main file - is changed; + after that, the program will be recompiled. + By default, tup will not track files outside the directory with "tup init"; + if tracking files in program directory is not sufficient for you, + consider adding updater.full_deps=1 to tup config - see tup manual + for details, for Linux it requires setting tup as suid root - or extending + tup data to the entire repository as described in Q6/A6. + + Settings can be configured using the file tup.config. Look to + tup.config.template in the repository root for complete list; + for most programs, only CONFIG_LANG and CONFIG_KPACK_CMD have effect. + + If the program uses libraries or helper files for gcc/msvc and you don't + want to build everything at once like Q6/A6, set + CONFIG_HELPERDIR=. + in tup.config, copy programs/use_gcc.lua or programs/use_msvc.lua + and helpers for used libraries, if any, to the directory of the program. + use_gcc.lua and use_msvc.lua do not require additional configuration; + in helpers for used libraries, set path to library in the first line. + Since copied helpers are local files not for the repository, you may use + absolute pathes specific for your machine. + This was designed so that no repository files need to be modified: + Tupfile.lua for the program is able to use either local helpers when + CONFIG_HELPERDIR is set, or repository helpers when the entire repository + is built. + You will also need compiled libraries. If they are included in SDK, use them. + Otherwise, compile them using the same process. Note that for a library, + "tup init" needs to be called in the library directory with include/ and lib/, + even if Tupfile.lua is present only in src/; libraries will be put in lib/. + +Q3. I want to add a program to the autobuild. +A3. Select a program from repository which uses same language and libraries. + Copy Tupfile.lua from that program to your program. + Change names of source and binary files accordingly. + If external files are referenced, correct relative pathes accordingly: + e.g. when programs/develop/libraries/menuetlibc_example/Tupfile.lua + references ../../../use_menuetlibc.lua, it resolves to + programs/use_menuetlibc.lua, if your program is built by + programs/other/super_program/Tupfile.lua, the path should be + ../../use_menuetlibc.lua. Commit. + + After that, the program will be built regularly. + To include the binary in kolibri.img or kolibri.iso, add it to one of + lists in data/Tupfile.lua. Select the section corresponding to the used + language so that people who build images without your compiler would still + be able to do so. + +Q4. I want to build the entire system. +A4. Why? Even the person who has configured the autobuild server does not build + everything on her computer. + + If you want to create your own image of the system, it is much simpler to + start from existing one and modify it, building only what is necessary. + If you don't know how to modify an image, don't expect that the build + system will magically do it for you. The build system uses mtools for + image manipulation; if you have configured mtools, you can just use them + directly. There are also other ways of image manipulation, which would + be closed for you once you decide to become attached to the build system. + + If you want to verify or debug your changes in Q3/A3, it is normally + sufficient to build just what you have changed as in Q2/A2. + To be extra sure, you can build from the repository root as in Q6/A6 + limiting to your compiler and FASM for some helper tasks; + any possible differences between this mode and actions of the autobuild + server are due to environment issues, like Windows vs Linux, + and would not be resolved anyway. + + If you just want it, note that the full build requires all compilers + listed in Q1/A1 and Linux. MinGW and Cygwin will not help you. + +Q5. I'm sure that I want to build the entire system. + The autobuild server does this, after all. +A5. The autobuild server has one concrete configuration with 64-bit Linux. + The developers are slightly interested in compiling programs in different + systems, but nobody needs portability of actions that only one server + does anyway. + + So, don't expect support from developers. Though, here goes the instruction + in interest of completeness. + + * Configure all compilers as described in Q2/A2. + * Configure kpack and kerpack as described in Q2/A2. + They are optional for Q2/A2, but required here, + the image just could not contain all programs in unpacked form. + * Configure mtools, so that mformat, mmd and mcopy are somewhere in PATH. + * Configure mkisofs. + * For full duplication of the autobuild server configure build variants: + create directories build-eng, build-rus, ... in the root of repository for + every subdirectory in data/ except data/common. Create files + build-eng/tup.config, build-rus/tup.config, ... with + CONFIG_BUILD_TYPE=eng, rus, ... correspondingly. This will switch + to out-of-tree builds for every variant. If one build type is sufficient + for you, you may skip this step. + * Run + tup init + in the root of repository. + * Run + tup + anywhere inside repository. + * If everything went good, there should be files kolibri.img and kolibri.iso + in every build-* directory. When you want to update, + rerun tup without arguments. + +Q6. I don't want to keep a zoo of compilers and tools required for Q5, + but I still want to build as many programs as possible with what I have. +A6. + * Configure all compilers you want to use as described in Q2/A2. + * Create tup.config in the root of repository. Disable all compilers you + don't want to use there; comments in tup.config.template should help you. + * Optionally, configure kpack and kerpack as described in Q2/A2. + * Run + tup init + in the root of repository. + * Run + tup + anywhere inside repository. diff --git a/data/Tupfile.lua b/data/Tupfile.lua new file mode 100644 index 0000000000..ae52a07106 --- /dev/null +++ b/data/Tupfile.lua @@ -0,0 +1,597 @@ +-- Do nothing unless explicitly requested in tup.config. +build_type = tup.getconfig('BUILD_TYPE') +if build_type == "" then + return +end + +--[================================[ DATA ]================================]-- + +PROGS = "../programs" + +-- Static data that doesn't need to be compiled +-- Files to be included in kolibri.img. +-- The first subitem of every item is name inside kolibri.img, the second is name of local file. +img_files = { + {"MACROS.INC", PROGS .. "/macros.inc"}, + {"CONFIG.INC", PROGS .. "/config.inc"}, + {"STRUCT.INC", PROGS .. "/struct.inc"}, + {"DEVELOP/TE_ICON.PNG", PROGS .. "/other/t_edit/te_icon.png"}, + {"DEVELOP/TL_NOD_16.PNG", PROGS .. "/other/t_edit/tl_nod_16.png"}, + {"DEVELOP/TL_SYS_16.PNG", PROGS .. "/media/log_el/trunk/tl_sys_16.png"}, + {"DEVELOP/T_EDIT.INI", PROGS .. "/other/t_edit/t_edit.ini"}, + {"File Managers/Z_ICONS.PNG", PROGS .. "/fs/opendial/z_icons.png"}, + {"File Managers/BUTTONS.BMP", PROGS .. "/fs/kfm/trunk/buttons.bmp"}, + {"File Managers/ICONS.BMP", PROGS .. "/fs/kfm/trunk/icons.bmp"}, + {"FONTS/LITT.CHR", PROGS .. "/demos/bgitest/trunk/FONTS/LITT.CHR"}, + {"GAMES/SNAKE.INI", PROGS .. "/games/snake/trunk/snake.ini"}, + {"MEDIA/KIV.INI", PROGS .. "/media/kiv/trunk/kiv.ini"}, + {"NETWORK/WV_SKIN.PNG", PROGS .. "/cmm/browser/wv_skin.png"}, + {"SETTINGS/AUTORUN.DAT", build_type .. "/settings/autorun.dat"}, + {"DEFAULT.SKN", build_type .. "/default.skn"}, + {"SETTINGS/ICON.INI", build_type .. "/settings/icon.ini"}, + {"ICONSTRP.PNG", "common/iconstrp.png"}, + {"INDEX.HTM", build_type .. "/index_htm"}, + {"KERPACK", "common/kerpack"}, + {"SETTINGS/KEYMAP.KEY", build_type .. "/settings/keymap.key"}, + {"SETTINGS/LANG.INI", build_type .. "/settings/lang.ini"}, + {"KUZKINA.MID", "common/kuzkina.mid"}, + {"LANG.INC", build_type .. "/lang.inc"}, + {"SETTINGS/MENU.DAT", build_type .. "/settings/menu.dat"}, + {"SETTINGS/KOLIBRI.LBL", build_type .. "/settings/kolibri.lbl"}, + {"SETTINGS/PANEL.INI", build_type .. "/settings/panel.ini"}, + {"SETTINGS/DOCKY.INI", "common/settings/docky.ini"}, + {"NOTIFY3.PNG", "common/notify3.png"}, + {"SETTINGS/SETUP.DAT", build_type .. "/settings/setup.dat"}, + {"VMODE", "common/vmode"}, + {"3D/CUBELINE", "common/3d/cubeline"}, + {"3D/GEARS", "common/3d/gears"}, + {"3D/HOUSE.3DS", "common/3d/house.3ds"}, + {"DEMOS/AK47.LIF", "common/demos/ak47.lif"}, + {"DEMOS/LIFE2", "common/demos/life2"}, + {"DEMOS/RELAY.LIF", "common/demos/relay.lif"}, + {"DEMOS/RPENTO.LIF", "common/demos/rpento.lif"}, + {"File Managers/EOLITE.INI", "common/File Managers/eolite.ini"}, + {"File Managers/ICONS.INI", "common/File Managers/icons.ini"}, + {"File Managers/KFM.INI", "common/File Managers/kfm.ini"}, + {"GAMES/CHECKERS", build_type .. "/games/checkers"}, + {"GAMES/MEGAMAZE", build_type .. "/games/megamaze"}, + {"GAMES/REVERSI", build_type .. "/games/reversi"}, + {"GAMES/RFORCES", build_type .. "/games/rforces"}, + {"GAMES/XONIX", build_type .. "/games/xonix"}, + {"LIB/PIXLIB.OBJ", "common/lib/pixlib.obj"}, + {"LIB/ICONV.OBJ", "common/lib/iconv.obj"}, + {"LIB/NETCODE.OBJ", "common/lib/netcode.obj"}, + {"MEDIA/ImgF/ImgF", "common/media/ImgF/ImgF"}, + {"MEDIA/ImgF/cEdg.obj", "common/media/ImgF/cEdg.obj"}, + {"MEDIA/ImgF/dither.obj", "common/media/ImgF/dither.obj"}, + {"MEDIA/ImgF/invSol.obj", "common/media/ImgF/invSol.obj"}, + {"SETTINGS/NETWORK.INI", build_type .. "/settings/network.ini"}, + {"NETWORK/FTPD.INI", "common/network/ftpd.ini"}, + {"NETWORK/USERS.INI", "common/network/users.ini"}, +} +-- For russian build, add russian-only files. +if build_type == "rus" then tup.append_table(img_files, { + {"File Managers/KFM_KEYS.TXT", PROGS .. "/fs/kfm/trunk/docs/russian/dos_kolibri/kfm_keys.txt"}, + {"SETTINGS/.shell", PROGS .. "/system/shell/bin/rus/.shell"}, + {"SETTINGS/MYKEY.INI", PROGS .. "/system/MyKey/trunk/mykey.ini"}, + {"EXAMPLE.ASM", PROGS .. "/develop/examples/example/trunk/rus/example.asm"}, + {"PIPETKA", build_type .. "/pipetka"}, + {"File Managers/KFAR.INI", build_type .. "/File Managers/kfar.ini"}, + {"GAMES/APPDATA.DAT", build_type .. "/games/appdata.dat"}, + {"GAMES/ATAKA", build_type .. "/games/ataka"}, + {"GAMES/BASEKURS.KLA", build_type .. "/games/basekurs.kla"}, + {"GAMES/PADENIE", build_type .. "/games/padenie"}, + {"GAMES/WHOWTBAM", build_type .. "/games/whowtbam"}, +}) else tup.append_table(img_files, { + {"File Managers/KFM_KEYS.TXT", PROGS .. "/fs/kfm/trunk/docs/english/kfm_keys.txt"}, + {"GAMES/SKIN.RAW", PROGS .. "/games/soko/trunk/SKIN.RAW"}, + {"GAMES/SOKO-4.LEV", PROGS .. "/games/soko/trunk/SOKO-4.LEV"}, + {"GAMES/SOKO-5.LEV", PROGS .. "/games/soko/trunk/SOKO-5.LEV"}, + {"GAMES/SOKO-6.LEV", PROGS .. "/games/soko/trunk/SOKO-6.LEV"}, + {"GAMES/SOKO-7.LEV", PROGS .. "/games/soko/trunk/SOKO-7.LEV"}, + {"GAMES/SOKO-8.LEV", PROGS .. "/games/soko/trunk/SOKO-8.LEV"}, + {"GAMES/SOKO-9.LEV", PROGS .. "/games/soko/trunk/SOKO-9.LEV"}, + {"SETTINGS/.shell", PROGS .. "/system/shell/bin/eng/.shell"}, + {"EXAMPLE.ASM", PROGS .. "/develop/examples/example/trunk/example.asm"}, + {"File Managers/KFAR.INI", "common/File Managers/kfar.ini"}, +}) end +if build_type == "it" then tup.append_table(img_files, { + {"SETTINGS/MYKEY.INI", PROGS .. "/system/MyKey/trunk/mykey_it.ini"}, +}) else tup.append_table(img_files, { + {"SETTINGS/MYKEY.INI", PROGS .. "/system/MyKey/trunk/mykey.ini"}, +}) end + +--[[ +Files to be included in kolibri.iso and distribution kit outside of kolibri.img. +The first subitem of every item is name relative to the root of ISO or distribution kit, +the second is name of local file. +If the first subitem ends in /, the last component of local file name is appended. +The last component of the second subitem may contain '*'; if so, it will be expanded +according to usual rules, but without matching directories. +--]] +extra_files = { + {"/", build_type .. "/distr_data/autorun.inf"}, + {"/", build_type .. "/distr_data/KolibriOS_icon.ico"}, + {"/", build_type .. "/settings/kolibri.lbl"}, + {"Skins/", "../skins/authors.txt"}, + {"Docs/stack.txt", build_type .. "/docs/STACK.TXT"}, + {"HD_Load/9x2klbr/", "common/HD_load/9x2klbr/LDKLBR.VXD"}, + {"HD_Load/MeOSLoad/", PROGS .. "/hd_load/meosload/AUTOEXEC.BAT"}, + {"HD_Load/MeOSLoad/", PROGS .. "/hd_load/meosload/CONFIG.SYS"}, + {"HD_Load/MeOSLoad/", PROGS .. "/hd_load/meosload/L_readme.txt"}, + {"HD_Load/MeOSLoad/", PROGS .. "/hd_load/meosload/L_readme_Win.txt"}, + {"HD_Load/mtldr/", PROGS .. "/hd_load/mtldr/vista_install.bat"}, + {"HD_Load/mtldr/", PROGS .. "/hd_load/mtldr/vista_remove.bat"}, + {"HD_Load/", "common/HD_load/memdisk"}, + {"HD_Load/USB_boot_old/", PROGS .. "/hd_load/usb_boot_old/usb_boot.rtf"}, + {"HD_Load/USB_boot_old/", PROGS .. "/hd_load/usb_boot_old/usb_boot_866.txt"}, + {"HD_Load/USB_boot_old/", PROGS .. "/hd_load/usb_boot_old/usb_boot_1251.txt"}, + {"games/pig/", "common/games/pig/*"}, + {"games/soko/soko", build_type .. "/games/soko"}, + {"games/soko/", "common/games/soko/*"}, + {"kolibrios/emul/dosbox/", "common/emul/DosBox/*"}, + {"kolibrios/emul/fceu/", "common/emul/fceu/*"}, + {"kolibrios/emul/", "common/emul/gameboy"}, + {"kolibrios/emul/", "common/emul/scummvm"}, + {"kolibrios/emul/", "common/emul/zsnes"}, + {"kolibrios/games/doom/", "common/games/doom/*"}, + {"kolibrios/games/fara/fara", build_type .. "/games/fara"}, + {"kolibrios/games/fara/fara.gfx", "common/games/fara.gfx"}, + {"kolibrios/games/jumpbump/", "common/games/jumpbump/*"}, + {"kolibrios/games/quake/", "common/games/quake/*"}, + {"kolibrios/games/lrl/", "common/games/lrl/*"}, + {"kolibrios/lib/avcodec-55.dll", "common/lib/avcodec-55.dll"}, + {"kolibrios/lib/avdevice-55.dll", "common/lib/avdevice-55.dll"}, + {"kolibrios/lib/avformat-55.dll", "common/lib/avformat-55.dll"}, + {"kolibrios/lib/avutil-52.dll", "common/lib/avutil-52.dll"}, + {"kolibrios/lib/freetype.dll", "common/lib/freetype.dll"}, + {"kolibrios/lib/libc.dll", "common/lib/libc.dll"}, + {"kolibrios/lib/pixlib.dll", "common/lib/pixlib.dll"}, + {"kolibrios/lib/swresample-0.dll", "common/lib/swresample-0.dll"}, + {"kolibrios/lib/swscale-2.dll", "common/lib/swscale-2.dll"}, + {"kolibrios/lib/zlib.dll", "common/lib/zlib.dll"}, + {"kolibrios/media/fplay-full", "common/media/fplay-full"}, + {"kolibrios/media/zsea/zsea.ini", PROGS .. "/media/zsea/zSea.ini"}, + {"kolibrios/media/zsea/buttons/buttons.png", PROGS .. "/media/zsea/buttons.png"}, +} +if build_type == "rus" then tup.append_table(extra_files, { + {"Docs/cp866/config.txt", build_type .. "/docs/CONFIG.TXT"}, + {"Docs/cp866/gnu.txt", build_type .. "/docs/GNU.TXT"}, + {"Docs/cp866/history.txt", build_type .. "/docs/HISTORY.TXT"}, + {"Docs/cp866/hot_keys.txt", build_type .. "/docs/HOT_KEYS.TXT"}, + {"Docs/cp866/install.txt", build_type .. "/docs/INSTALL.TXT"}, + {"Docs/cp866/readme.txt", build_type .. "/docs/README.TXT"}, + {"Docs/cp866/sysfuncr.txt", PROGS .. "/system/docpack/trunk/SYSFUNCR.TXT"}, + {"Docs/cp1251/config.txt", build_type .. "/docs/CONFIG.WIN.TXT", cp1251_from = build_type .. "/docs/CONFIG.TXT"}, + {"Docs/cp1251/gnu.txt", build_type .. "/docs/GNU.WIN.TXT", cp1251_from = build_type .. "/docs/GNU.TXT"}, + {"Docs/cp1251/history.txt", build_type .. "/docs/HISTORY.WIN.TXT", cp1251_from = build_type .. "/docs/HISTORY.TXT"}, + {"Docs/cp1251/hot_keys.txt", build_type .. "/docs/HOT_KEYS.WIN.TXT", cp1251_from = build_type .. "/docs/HOT_KEYS.TXT"}, + {"Docs/cp1251/install.txt", build_type .. "/docs/INSTALL.WIN.TXT", cp1251_from = build_type .. "/docs/INSTALL.TXT"}, + {"Docs/cp1251/readme.txt", build_type .. "/docs/README.WIN.TXT", cp1251_from = build_type .. "/docs/README.TXT"}, + {"Docs/cp1251/sysfuncr.txt", build_type .. "/docs/SYSFUNCR.WIN.TXT", cp1251_from = PROGS .. "/system/docpack/trunk/SYSFUNCR.TXT"}, + {"HD_Load/9x2klbr/", PROGS .. "/hd_load/9x2klbr/readme_dos.txt"}, + {"HD_Load/9x2klbr/", PROGS .. "/hd_load/9x2klbr/readme_win.txt"}, + {"HD_Load/mtldr/", PROGS .. "/hd_load/mtldr/install.txt"}, + {"HD_Load/USB_Boot/", PROGS .. "/hd_load/usb_boot/readme.txt"}, + {"kolibrios/media/zsea/zsea_keys.txt", PROGS .. "/media/zsea/Docs/zSea_keys_rus.txt"}, +}) else tup.append_table(extra_files, { + {"Docs/config.txt", build_type .. "/docs/CONFIG.TXT"}, + {"Docs/copying.txt", build_type .. "/docs/COPYING.TXT"}, + {"Docs/hot_keys.txt", build_type .. "/docs/HOT_KEYS.TXT"}, + {"Docs/install.txt", build_type .. "/docs/INSTALL.TXT"}, + {"Docs/readme.txt", build_type .. "/docs/README.TXT"}, + {"Docs/sysfuncs.txt", PROGS .. "/system/docpack/trunk/SYSFUNCS.TXT"}, + {"HD_Load/9x2klbr/", PROGS .. "/hd_load/9x2klbr/readme.txt"}, + {"HD_Load/mtldr/install.txt", PROGS .. "/hd_load/mtldr/install_eng.txt"}, + {"HD_Load/USB_Boot/readme.txt", PROGS .. "/hd_load/usb_boot/readme_eng.txt"}, + {"kolibrios/media/zsea/zsea_keys.txt", PROGS .. "/media/zsea/Docs/zSea_keys_eng.txt"}, +}) end +--[[ +Files to be included in distribution kit outside of kolibri.img, but not kolibri.iso. +Same syntax as extra_files. +]]-- +if build_type == "rus" then +distr_extra_files = { + {"/readme_dos.txt", build_type .. "/distr_data/readme_dos_distr.txt"}, + {"/readme.txt", build_type .. "/distr_data/readme_distr.txt", cp1251_from = build_type .. "/distr_data/readme_dos_distr.txt"}, +} +else +distr_extra_files = { + {"/readme.txt", build_type .. "/distr_data/readme_distr.txt"}, +} +end +--[[ +Files to be included in kolibri.iso outside of kolibri.img, but not distribution kit. +Same syntax as extra_files. +]]-- +if build_type == "rus" then +iso_extra_files = { + {"/readme_dos.txt", build_type .. "/distr_data/readme_dos.txt"}, + {"/readme.txt", build_type .. "/distr_data/readme.txt", cp1251_from = build_type .. "/distr_data/readme_dos.txt"}, +} +else +iso_extra_files = { + {"/readme.txt", build_type .. "/distr_data/readme.txt"}, +} +end + +-- Programs that require FASM to compile. +if tup.getconfig('NO_FASM') ~= 'full' then +tup.append_table(img_files, { + {"KERNEL.MNT", "../kernel/trunk/kernel.mnt"}, + {"@MENU", PROGS .. "/system/menu/trunk/menu"}, + {"@PANEL", PROGS .. "/system/panel/trunk/@PANEL"}, + {"@DOCKY", PROGS .. "/system/docky/trunk/docky"}, + {"@NOTIFY", PROGS .. "/system/notify3/notify"}, + {"@SS", PROGS .. "/system/ss/trunk/@ss"}, + {"REFRSCRN", PROGS .. "/system/refrscrn/refrscrn"}, + {"ASCIIVJU", PROGS .. "/develop/asciivju/trunk/asciivju"}, + {"CALC", PROGS .. "/other/calc/trunk/calc"}, + {"CALENDAR", PROGS .. "/system/calendar/trunk/calendar"}, + {"COLRDIAL", PROGS .. "/system/colrdial/color_dialog"}, + {"LOADDRV", PROGS .. "/system/loaddrv/loaddrv"}, + {"CPU", PROGS .. "/system/cpu/trunk/cpu"}, + {"CPUID", PROGS .. "/system/cpuid/trunk/CPUID"}, + {"DESKTOP", PROGS .. "/system/desktop/trunk/desktop"}, + {"DISPTEST", PROGS .. "/system/disptest/trunk/disptest"}, + {"DOCPACK", PROGS .. "/system/docpack/trunk/docpack"}, + {"END", PROGS .. "/system/end/light/end"}, + {"FSPEED", PROGS .. "/fs/fspeed/fspeed"}, + {"GMON", PROGS .. "/system/gmon/gmon"}, + {"HDD_INFO", PROGS .. "/system/hdd_info/trunk/hdd_info"}, + {"@ICON", PROGS .. "/system/icon_new/@icon"}, + {"CROPFLAT", PROGS .. "/system/cropflat/cropflat"}, + {"KBD", PROGS .. "/system/kbd/trunk/kbd"}, + {"KPACK", PROGS .. "/other/kpack/trunk/kpack"}, + {"LAUNCHER", PROGS .. "/system/launcher/trunk/launcher"}, + {"MAGNIFY", PROGS .. "/demos/magnify/trunk/magnify"}, + {"MGB", PROGS .. "/system/mgb/trunk/mgb"}, + {"MOUSEMUL", PROGS .. "/system/mousemul/trunk/mousemul"}, + {"MADMOUSE", PROGS .. "/other/madmouse/madmouse"}, + {"MYKEY", PROGS .. "/system/MyKey/trunk/MyKey"}, + {"PCIDEV", PROGS .. "/system/pcidev/trunk/PCIDEV"}, + {"RDSAVE", PROGS .. "/system/rdsave/trunk/rdsave"}, + {"RTFREAD", PROGS .. "/other/rtfread/trunk/rtfread"}, + {"RUN", PROGS .. "/system/run/trunk/run"}, + {"SEARCHAP", PROGS .. "/system/searchap/searchap"}, + {"SCRSHOOT", PROGS .. "/media/scrshoot/scrshoot"}, + {"SETUP", PROGS .. "/system/setup/trunk/setup"}, + {"TEST", PROGS .. "/system/test/trunk/test"}, + {"TINYPAD", PROGS .. "/develop/tinypad/trunk/tinypad"}, + {"ZKEY", PROGS .. "/system/zkey/trunk/ZKEY"}, + {"TERMINAL", PROGS .. "/system/terminal/terminal"}, + {"3D/3DSHEART", PROGS .. "/demos/3dsheart/trunk/3dsheart"}, + {"3D/3DWAV", PROGS .. "/demos/3dwav/trunk/3dwav"}, + {"3D/CROWNSCR", PROGS .. "/demos/crownscr/trunk/crownscr"}, + {"3D/FREE3D04", PROGS .. "/demos/free3d04/trunk/free3d04"}, + {"3D/VIEW3DS", PROGS .. "/demos/3DS/VIEW3DS"}, + {"DEMOS/BCDCLK", PROGS .. "/demos/bcdclk/trunk/bcdclk"}, + {"DEMOS/CIRCLE", PROGS .. "/develop/examples/circle/trunk/circle"}, + {"DEMOS/COLORREF", PROGS .. "/demos/colorref/trunk/colorref"}, + {"DEMOS/CSLIDE", PROGS .. "/demos/cslide/trunk/cslide"}, + {"DEMOS/EYES", PROGS .. "/demos/eyes/trunk/eyes"}, + {"DEMOS/FIREWORK", PROGS .. "/demos/firework/trunk/firework"}, + {"DEMOS/MOVBACK", PROGS .. "/demos/movback/trunk/movback"}, + {"DEMOS/PLASMA", PROGS .. "/demos/plasma/trunk/plasma"}, + {"DEMOS/TINYFRAC", PROGS .. "/demos/tinyfrac/trunk/tinyfrac"}, + {"DEMOS/TRANTEST", PROGS .. "/demos/trantest/trunk/trantest"}, + {"DEMOS/TUBE", PROGS .. "/demos/tube/trunk/tube"}, + {"DEMOS/UNVWATER", PROGS .. "/demos/unvwater/trunk/unvwater"}, + {"DEMOS/USE_MB", PROGS .. "/demos/use_mb/use_mb"}, + {"DEMOS/WEB", PROGS .. "/demos/web/trunk/web"}, + {"DEVELOP/BOARD", PROGS .. "/system/board/trunk/board"}, + {"DEVELOP/cObj", PROGS .. "/develop/cObj/trunk/cObj"}, + {"DEVELOP/FASM", PROGS .. "/develop/fasm/trunk/fasm"}, + {"DEVELOP/H2D2B", PROGS .. "/develop/h2d2b/trunk/h2d2b"}, + {"DEVELOP/HEED", PROGS .. "/develop/heed/trunk/heed"}, + {"DEVELOP/KEYASCII", PROGS .. "/develop/keyascii/trunk/keyascii"}, + {"DEVELOP/MTDBG", PROGS .. "/develop/mtdbg/mtdbg"}, + {"DEVELOP/SCANCODE", PROGS .. "/develop/scancode/trunk/scancode"}, + {"DEVELOP/T_EDIT", PROGS .. "/other/t_edit/t_edit"}, + {"DEVELOP/test_gets", PROGS .. "/develop/libraries/console/examples/test_gets"}, + {"DEVELOP/THREAD", PROGS .. "/develop/examples/thread/trunk/thread"}, + {"DEVELOP/INFO/ASM.SYN", PROGS .. "/other/t_edit/info/asm.syn"}, + {"DEVELOP/INFO/CPP_KOL_CLA.SYN", PROGS .. "/other/t_edit/info/cpp_kol_cla.syn"}, + {"DEVELOP/INFO/CPP_KOL_DAR.SYN", PROGS .. "/other/t_edit/info/cpp_kol_dar.syn"}, + {"DEVELOP/INFO/CPP_KOL_DEF.SYN", PROGS .. "/other/t_edit/info/cpp_kol_def.syn"}, + {"DEVELOP/INFO/DEFAULT.SYN", PROGS .. "/other/t_edit/info/default.syn"}, + {"DEVELOP/INFO/HTML.SYN", PROGS .. "/other/t_edit/info/html.syn"}, + {"DEVELOP/INFO/INI_FILES.SYN", PROGS .. "/other/t_edit/info/ini_files.syn"}, + {"DEVELOP/INFO/WIN_CONST.SYN", PROGS .. "/other/t_edit/info/win_const.syn"}, + {"File Managers/KFAR", PROGS .. "/fs/kfar/trunk/kfar"}, + {"File Managers/KFM", PROGS .. "/fs/kfm/trunk/kfm"}, + {"File Managers/OPENDIAL", PROGS .. "/fs/opendial/opendial"}, + {"GAMES/15", PROGS .. "/games/15/trunk/15"}, + {"GAMES/ARCANII", PROGS .. "/games/arcanii/trunk/arcanii"}, + {"GAMES/FREECELL", PROGS .. "/games/freecell/freecell"}, + {"GAMES/GOMOKU", PROGS .. "/games/gomoku/trunk/gomoku"}, + {"GAMES/INVADERS", PROGS .. "/games/invaders/invaders"}, + {"GAMES/KLAVISHA", PROGS .. "/games/klavisha/trunk/klavisha"}, + {"GAMES/LINES", PROGS .. "/games/lines/lines"}, + {"GAMES/MBLOCKS", PROGS .. "/games/mblocks/trunk/mblocks"}, + {"GAMES/MSQUARE", PROGS .. "/games/MSquare/trunk/MSquare"}, + {"GAMES/PHENIX", PROGS .. "/games/phenix/trunk/phenix"}, + {"GAMES/PIPES", PROGS .. "/games/pipes/pipes"}, + {"GAMES/PONG", PROGS .. "/games/pong/trunk/pong"}, + {"GAMES/PONG3", PROGS .. "/games/pong3/trunk/pong3"}, + {"GAMES/RSQUARE", PROGS .. "/games/rsquare/trunk/rsquare"}, + {"GAMES/SNAKE", PROGS .. "/games/snake/trunk/snake"}, + {"GAMES/SQ_GAME", PROGS .. "/games/sq_game/trunk/SQ_GAME"}, + {"GAMES/SUDOKU", PROGS .. "/games/sudoku/trunk/sudoku"}, + {"GAMES/SW", PROGS .. "/games/sw/trunk/sw"}, + {"GAMES/TANKS", PROGS .. "/games/tanks/trunk/tanks"}, + {"GAMES/TETRIS", PROGS .. "/games/tetris/trunk/tetris"}, + {"LIB/ARCHIVER.OBJ", PROGS .. "/fs/kfar/trunk/kfar_arc/kfar_arc.obj"}, + {"LIB/BOX_LIB.OBJ", PROGS .. "/develop/libraries/box_lib/trunk/box_lib.obj"}, + {"LIB/BUF2D.OBJ", PROGS .. "/develop/libraries/buf2d/trunk/buf2d.obj"}, + {"LIB/CONSOLE.OBJ", PROGS .. "/develop/libraries/console/console.obj"}, + {"LIB/LIBGFX.OBJ", PROGS .. "/develop/libraries/libs-dev/libgfx/libgfx.obj"}, + {"LIB/LIBIMG.OBJ", PROGS .. "/develop/libraries/libs-dev/libimg/libimg.obj"}, + {"LIB/LIBINI.OBJ", PROGS .. "/develop/libraries/libs-dev/libini/libini.obj"}, + {"LIB/LIBIO.OBJ", PROGS .. "/develop/libraries/libs-dev/libio/libio.obj"}, + {"LIB/MSGBOX.OBJ", PROGS .. "/develop/libraries/msgbox/msgbox.obj"}, + {"LIB/NETWORK.OBJ", PROGS .. "/develop/libraries/network/network.obj"}, + {"LIB/SORT.OBJ", PROGS .. "/develop/libraries/sorter/sort.obj"}, + {"LIB/HTTP.OBJ", PROGS .. "/develop/libraries/http/http.obj"}, + {"LIB/PROC_LIB.OBJ", PROGS .. "/develop/libraries/proc_lib/trunk/proc_lib.obj"}, + {"LIB/CNV_PNG.OBJ", PROGS .. "/media/zsea/plugins/png/cnv_png.obj"}, + {"MEDIA/ANIMAGE", PROGS .. "/media/animage/trunk/animage"}, + {"MEDIA/KIV", PROGS .. "/media/kiv/trunk/kiv"}, + {"MEDIA/LISTPLAY", PROGS .. "/media/listplay/trunk/listplay"}, + {"MEDIA/MIDAMP", PROGS .. "/media/midamp/trunk/midamp"}, + {"MEDIA/PALITRA", PROGS .. "/media/palitra/trunk/palitra"}, + {"MEDIA/STARTMUS", PROGS .. "/media/startmus/trunk/STARTMUS"}, + {"NETWORK/PING", PROGS .. "/network/icmp/ping"}, + {"NETWORK/NETCFG", PROGS .. "/network/netcfg/netcfg"}, + {"NETWORK/NETSTAT", PROGS .. "/network/netstat/netstat"}, + {"NETWORK/NSLOOKUP", PROGS .. "/network/nslookup/nslookup"}, + {"NETWORK/PASTA", PROGS .. "/network/pasta/pasta"}, + {"NETWORK/SYNERGYC", PROGS .. "/network/synergyc/synergyc"}, + {"NETWORK/TCPSERV", PROGS .. "/network/tcpserv/tcpserv"}, + {"NETWORK/TELNET", PROGS .. "/network/telnet/telnet"}, + {"NETWORK/ZEROCONF", PROGS .. "/network/zeroconf/zeroconf"}, + {"NETWORK/FTPC", PROGS .. "/network/ftpc/ftpc"}, + {"NETWORK/FTPD", PROGS .. "/network/ftpd/ftpd"}, + {"NETWORK/TFTPC", PROGS .. "/network/tftpc/tftpc"}, + {"NETWORK/IRCC", PROGS .. "/network/ircc/ircc"}, + {"NETWORK/DOWNLOADER", PROGS .. "/network/downloader/downloader"}, + {"DRIVERS/VIDINTEL.SYS", "../drivers/video/vidintel.sys"}, + {"DRIVERS/3C59X.SYS", "../drivers/ethernet/3c59x.sys"}, + {"DRIVERS/DEC21X4X.SYS", "../drivers/ethernet/dec21x4x.sys"}, + {"DRIVERS/FORCEDETH.SYS", "../drivers/ethernet/forcedeth.sys"}, + {"DRIVERS/I8254X.SYS", "../drivers/ethernet/i8254x.sys"}, + {"DRIVERS/I8255X.SYS", "../drivers/ethernet/i8255x.sys"}, + {"DRIVERS/MTD80X.SYS", "../drivers/ethernet/mtd80x.sys"}, + {"DRIVERS/PCNET32.SYS", "../drivers/ethernet/pcnet32.sys"}, + {"DRIVERS/R6040.SYS", "../drivers/ethernet/R6040.sys"}, + {"DRIVERS/RHINE.SYS", "../drivers/ethernet/rhine.sys"}, + {"DRIVERS/RTL8029.SYS", "../drivers/ethernet/RTL8029.sys"}, + {"DRIVERS/RTL8139.SYS", "../drivers/ethernet/RTL8139.sys"}, + {"DRIVERS/RTL8169.SYS", "../drivers/ethernet/RTL8169.sys"}, + {"DRIVERS/SIS900.SYS", "../drivers/ethernet/sis900.sys"}, + {"DRIVERS/UHCI.SYS", "../drivers/usb/uhci.sys"}, + {"DRIVERS/OHCI.SYS", "../drivers/usb/ohci.sys"}, + {"DRIVERS/EHCI.SYS", "../drivers/usb/ehci.sys"}, + {"DRIVERS/USBHID.SYS", "../drivers/usb/usbhid/usbhid.sys"}, + {"DRIVERS/USBSTOR.SYS", "../drivers/usb/usbstor.sys"}, + {"DRIVERS/RDC.SYS", "../drivers/video/rdc.sys"}, + {"DRIVERS/COMMOUSE.SYS", "../drivers/mouse/commouse.sys"}, + {"DRIVERS/PS2MOUSE.SYS", "../drivers/mouse/ps2mouse4d/trunk/ps2mouse.sys"}, + {"DRIVERS/TMPDISK.SYS", "../drivers/disk/tmpdisk.sys"}, + {"DRIVERS/intel_hda.sys", "../drivers/audio/intel_hda/intel_hda.sys"}, + {"DRIVERS/SB16.SYS", "../drivers/audio/sb16/sb16.sys"}, + {"DRIVERS/SOUND.SYS", "../drivers/audio/sound.sys"}, + {"DRIVERS/INFINITY.SYS", "../drivers/audio/infinity/infinity.sys"}, + {"DRIVERS/INTELAC97.SYS", "../drivers/audio/intelac97.sys"}, + {"DRIVERS/EMU10K1X.SYS", "../drivers/audio/emu10k1x.sys"}, + {"DRIVERS/FM801.SYS", "../drivers/audio/fm801.sys"}, + {"DRIVERS/VT823X.SYS", "../drivers/audio/vt823x.sys"}, + {"DRIVERS/SIS.SYS", "../drivers/audio/sis.sys"}, +}) +tup.append_table(extra_files, { + {"HD_Load/9x2klbr/", PROGS .. "/hd_load/9x2klbr/9x2klbr.exe"}, + {"HD_Load/MeOSLoad/", PROGS .. "/hd_load/meosload/MeOSload.com"}, + {"HD_Load/mtldr/", PROGS .. "/hd_load/mtldr/mtldr"}, + {"HD_Load/", PROGS .. "/hd_load/mtldr_install/mtldr_install.exe"}, + {"HD_Load/USB_Boot/", PROGS .. "/hd_load/usb_boot/BOOT_F32.BIN"}, + {"HD_Load/USB_Boot/", PROGS .. "/hd_load/usb_boot/MTLD_F32"}, + {"HD_Load/USB_Boot/", PROGS .. "/hd_load/usb_boot/inst.exe"}, + {"HD_Load/USB_Boot/", PROGS .. "/hd_load/usb_boot/setmbr.exe"}, + {"HD_Load/USB_boot_old/", PROGS .. "/hd_load/usb_boot_old/MeOSload.com"}, + {"HD_Load/USB_boot_old/", PROGS .. "/hd_load/usb_boot_old/enable.exe"}, + {"kolibrios/media/zsea/zsea", PROGS .. "/media/zsea/zSea"}, + {"kolibrios/media/zsea/plugins/cnv_bmp.obj", PROGS .. "/media/zsea/plugins/bmp/cnv_bmp.obj"}, + {"kolibrios/media/zsea/plugins/cnv_gif.obj", PROGS .. "/media/zsea/plugins/gif/cnv_gif.obj"}, + {"kolibrios/media/zsea/plugins/cnv_jpeg.obj", PROGS .. "/media/zsea/plugins/jpeg/cnv_jpeg.obj"}, + {"kolibrios/media/zsea/plugins/convert.obj", PROGS .. "/media/zsea/plugins/convert/convert.obj"}, + {"kolibrios/media/zsea/plugins/rotate.obj", PROGS .. "/media/zsea/plugins/rotate/rotate.obj"}, + {"kolibrios/media/zsea/plugins/scaling.obj", PROGS .. "/media/zsea/plugins/scaling/scaling.obj"}, +}) +-- For russian build, add russian-only programs. +if build_type == "rus" then tup.append_table(img_files, { + {"PERIOD", PROGS .. "/other/period/trunk/period"}, + {"DEVELOP/TESTCON2", PROGS .. "/develop/libraries/console/examples/testcon2_rus"}, +}) else tup.append_table(img_files, { + {"DEVELOP/TESTCON2", PROGS .. "/develop/libraries/console/examples/testcon2_eng"}, + {"GAMES/SOKO", PROGS .. "/games/soko/trunk/SOKO"}, +}) end + +end -- tup.getconfig('NO_FASM') ~= 'full' + +-- Programs that require NASM to compile. +if tup.getconfig('NO_NASM') ~= 'full' then +tup.append_table(img_files, { + {"DEMOS/ACLOCK", PROGS .. "/demos/aclock/trunk/aclock"}, + {"DEMOS/TIMER", PROGS .. "/other/Timer/timer"}, + {"GAMES/C4", PROGS .. "/games/c4/trunk/c4"}, + {"TINFO", PROGS .. "/system/tinfo/tinfo"}, + {"DEVELOP/MSTATE", PROGS .. "/develop/mstate/mstate"}, +}) +end -- tup.getconfig('NO_NASM') ~= 'full' + +-- Programs that require C-- to compile. +if tup.getconfig('NO_CMM') ~= 'full' then +tup.append_table(img_files, { + {"File Managers/EOLITE", PROGS .. "/cmm/eolite/Eolite.com"}, + {"GAMES/CLICKS", PROGS .. "/games/clicks/trunk/clicks.com"}, + {"GAMES/FindNumbers", PROGS .. "/games/FindNumbers/trunk/FindNumbers"}, + {"GAMES/flood-it", PROGS .. "/games/flood-it/trunk/flood-it.com"}, + {"GAMES/MINE", PROGS .. "/games/mine/trunk/mine"}, + {"NETWORK/WebView", PROGS .. "/cmm/browser/WebView.com"}, + {"TMPDISK", PROGS .. "/cmm/tmpdisk/tmpdisk.com"}, +}) +end -- tup.getconfig('NO_CMM') ~= 'full' + +-- Programs that require MSVC to compile. +if tup.getconfig('NO_MSVC') ~= 'full' then +tup.append_table(img_files, { + {"GRAPH", PROGS .. "/other/graph/graph"}, + {"TABLE", PROGS .. "/other/table/table"}, + {"MEDIA/AC97SND", PROGS .. "/media/ac97snd/ac97snd.bin"}, + {"GAMES/KOSILKA", PROGS .. "/games/kosilka/kosilka"}, +}) +end -- tup.getconfig('NO_MSVC') ~= 'full' + +-- Programs that require GCC to compile. +if tup.getconfig('NO_GCC') ~= 'full' then +tup.append_table(img_files, { + {"SHELL", PROGS .. "/system/shell/shell"}, +}) +tup.append_table(extra_files, { + {"kolibrios/emul/e80/e80", PROGS .. "/emulator/e80/trunk/e80"}, +}) +end -- tup.getconfig('NO_GCC') ~= 'full' + +-- Skins. +tup.include("../skins/skinlist.lua") + +--[================================[ CODE ]================================]-- +-- expand extra_files and similar +function expand_extra_files(files) + local result = {} + for i,v in ipairs(files) do + if string.match(v[2], "%*") + then + local g = tup.glob(v[2]) + for j,x in ipairs(g) do + table.insert(result, {v[1], x}) + end + else + if v.cp1251_from then + tup.definerule{inputs = {v.cp1251_from}, command = 'iconv -f cp866 -t cp1251 "%f" > "%o"', outputs = {v[2]}} + end + table.insert(result, {v[1], v[2]}) + end + end + return result +end + +-- append skins to extra_files +for i,v in ipairs(skinlist) do + table.insert(extra_files, {"Skins/", "../skins/" .. v}) +end + +-- prepare distr_extra_files and iso_extra_files: expand and append common part +extra_files = expand_extra_files(extra_files) +distr_extra_files = expand_extra_files(distr_extra_files) +iso_extra_files = expand_extra_files(iso_extra_files) +tup.append_table(distr_extra_files, extra_files) +tup.append_table(iso_extra_files, extra_files) + +-- generate list of directories to be created inside kolibri.img +img_dirs = {} +input_deps = {} +for i,v in ipairs(img_files) do + img_file = v[1] + local_file = v[2] + + slash_pos = 0 + while true do + slash_pos = string.find(img_file, '/', slash_pos + 1) + if not slash_pos then break end + table.insert(img_dirs, string.sub(img_file, 1, slash_pos - 1)) + end + + -- tup does not want to see hidden files as dependencies + if not string.match(local_file, "/%.") then + table.insert(input_deps, local_file) + end +end + +-- create empty 1.44M file +make_img_command = "dd if=/dev/zero of=kolibri.img count=2880 bs=512 2>&1" +-- format it as a standard 1.44M floppy +make_img_command = make_img_command .. " && mformat -f 1440 -i kolibri.img ::" +-- copy bootloader +if tup.getconfig("NO_FASM") ~= "full" then +bootloader = "../kernel/trunk/bootloader/boot_fat12.bin" +make_img_command = make_img_command .. " && dd if=" .. bootloader .. " of=kolibri.img count=1 bs=512 conv=notrunc 2>&1" +table.insert(input_deps, bootloader) +end +-- make folders +table.sort(img_dirs) +for i,v in ipairs(img_dirs) do + if v ~= img_dirs[i-1] then + make_img_command = make_img_command .. ' && mmd -i kolibri.img "::' .. v .. '"' + end +end +-- copy files +for i,v in ipairs(img_files) do + local_file = v[2] + if v[1] == "KERNEL.MNT" and tup.getconfig("INSERT_REVISION_ID") ~= "" + then + -- for kernel.mnt, insert autobuild revision identifier + -- from .revision to .kernel.mnt + -- note that .revision and .kernel.mnt must begin with . + -- to prevent tup from tracking them + if build_type == "rus" + then str='$(LANG=ru_RU.utf8 date -u +"[автосборка %d %b %Y %R, r$(cat .revision)]"|iconv -f utf8 -t cp866)' + else str='$(date -u +"[auto-build %d %b %Y %R, r$(cat .revision)]")' + end + str = string.gsub(str, "%$", "\\$") -- escape $ as \$ + str = string.gsub(str, "%%", "%%%%") -- escape % as %% + make_img_command = make_img_command .. " && cp " .. local_file .. " .kernel.mnt" + make_img_command = make_img_command .. " && str=" .. str + make_img_command = make_img_command .. ' && echo -n $str | dd of=.kernel.mnt bs=1 seek=`expr 279 - length "$str"` conv=notrunc 2>/dev/null' + local_file = ".kernel.mnt" + end + make_img_command = make_img_command .. ' && mcopy -moi kolibri.img "' .. local_file .. '" "::' .. v[1] .. '"' +end + +-- generate tup rule for kolibri.img +tup.definerule{inputs = input_deps, command = make_img_command, outputs = {"kolibri.img"}} + +-- generate command and dependencies for mkisofs +input_deps = {"kolibri.img"} +iso_files_list = "" +for i,v in ipairs(iso_extra_files) do + iso_files_list = iso_files_list .. ' "' .. v[1] .. '=' .. v[2] .. '"' + table.insert(input_deps, v[2]) +end + +-- generate tup rule for kolibri.iso +if tup.getconfig("INSERT_REVISION_ID") ~= "" +then volume_id = "KolibriOS r`cat .revision`" +else volume_id = "KolibriOS" +end +tup.definerule{inputs = input_deps, command = + 'mkisofs -U -J -pad -b kolibri.img -c boot.catalog -hide-joliet boot.catalog -graft-points ' .. + '-A "KolibriOS AutoBuilder" -p "CleverMouse" -publisher "KolibriOS Team" -V "' .. volume_id .. '" -sysid "KOLIBRI" ' .. + '-iso-level 3 -o kolibri.iso kolibri.img' .. iso_files_list .. ' 2>&1', + outputs = {"kolibri.iso"}} + +-- generate command and dependencies for distribution kit +input_deps = {"kolibri.img"} +output_deps = {"distribution_kit/kolibri.img"} +make_distr_command = "ln -sr kolibri.img distribution_kit/kolibri.img" +for i,v in ipairs(distr_extra_files) do + make_distr_command = make_distr_command .. ' && ln -sr "' .. v[2] .. '" "distribution_kit/' .. v[1] .. '"' + table.insert(input_deps, v[2]) + if string.sub(v[1], -1) == "/" + then table.insert(output_deps, "distribution_kit/" .. v[1] .. tup.file(v[2])) + else table.insert(output_deps, "distribution_kit/" .. v[1]) + end +end + +-- generate tup rule for distribution kit +tup.definerule{inputs = input_deps, command = make_distr_command, outputs = output_deps} diff --git a/data/common/Makefile.cmm b/data/common/Makefile.cmm deleted file mode 100644 index 5bf46e867c..0000000000 --- a/data/common/Makefile.cmm +++ /dev/null @@ -1,15 +0,0 @@ -# This is similar to Makefile.fasm, look there for comments. -# No dependency tracking, so force dependencies on all files -# in dir/* and dir/*/* -# Also, we cannot set output file name and need to guess -# whether c-- has created .com file or no-extension file. -define cmm_meta_rule -$(1): $(2) ../common/Makefile.cmm $$(call respace,$$(addsuffix .dir,$(3))) \ - $$(wildcard $$(dir $(2))*) $$(wildcard $$(dir $(2))*/*) - flock $$(dir $(2)).lock -c '\ - (cd "$$(dir $(2))" && win32-c-- /D=AUTOBUILD /D=LANG_RUS $(5) $$(notdir $(2)) >&2) && \ - if [ -e $$(basename $$<) ]; then f=$$(basename $$<); else f=$$(basename $$<).com; fi && \ - kpack --nologo $$$$f "$$@" && rm $$$$f' -endef - -$(foreach f,$(CMM_PROGRAMS),$(eval $(call cmm_meta_rule,$(fbinary),$(fsource),$(binarydir),$(progname),$(fparam)))) diff --git a/data/common/Makefile.copy b/data/common/Makefile.copy deleted file mode 100644 index c409ee0332..0000000000 --- a/data/common/Makefile.copy +++ /dev/null @@ -1,6 +0,0 @@ -# This is similar to Makefile.fasm, look there for comments. -define copy_meta_rule -$(1): $(2) ../common/Makefile.copy $$(call respace,$$(addsuffix .dir,$(3))) - cp $$< "$$@" -endef -$(foreach f,$(COPY_FILES),$(eval $(call copy_meta_rule,$(fbinary),$(fsource),$(binarydir)))) diff --git a/data/common/Makefile.fasm b/data/common/Makefile.fasm deleted file mode 100644 index 69e2004453..0000000000 --- a/data/common/Makefile.fasm +++ /dev/null @@ -1,60 +0,0 @@ -# This is not a independent Makefile; it is auxiliary file -# included from main Makefile. -# It depends on the following variables and macro: -# $(FASM_PROGRAMS) is a list of all programs to build with FASM rule; -# $(binarypart) is a macro which converts from $(1)=item of $(FASM_PROGRAMS) -# to space-escaped full name of binary, $(respace) unescapes spaces; -# $(fbinary) and $(fsource) gives space-unescaped full name of binary -# and source (respectively) of $(f)=item of $(FASM_PROGRAMS). - -# Define the rule for all FASM programs. -# Yes, this looks like a black magic. -# But it is not so scary as it seems. -# First, we define "meta-rule" as a rule which is -# macro depending on $(fasmprog). -# Second, the construction foreach+eval creates -# usual rules, one for each $(fasmprog) in $(FASM_PROGRAMS). -# Note that meta-rule is double-expanded, first -# time as the arg of eval - it is the place where $(fasmprog) -# gets expanded - and second time as the rule; -# so all $ which are expected to expand at the second time should be escaped. -# And all $ which are expected to be expanded by the shell should be escaped -# twice, so they become $$$$. - -# The arguments of macro fasm_meta_rule: -# $(1) = name of binary file, -# $(2) = name of main source file. -# $(3) = folder of binary file - without spaces. -# $(4) = name of program - without path and extension, -define fasm_meta_rule -$(1): $(2) ../common/Makefile.fasm .deps/.dir $$(call respace,$$(addsuffix .dir,$(3))) - tmpfile=`mktemp --tmpdir build.XXXXXXXX` && \ - (fasm -m 65536 "$$<" "$$@" -s $$$$tmpfile && \ - fasmdep -e $$$$tmpfile > .deps/$(4).Po && \ - rm $$$$tmpfile) || (rm $$$$tmpfile; false) - kpack --nologo "$$@" --include .deps/$(4).Po -endef - -define fasm_nokpack_meta_rule -$(1): $(2) ../common/Makefile.fasm .deps/.dir $$(call respace,$$(addsuffix .dir,$(3))) - tmpfile=`mktemp --tmpdir build.XXXXXXXX` && \ - (fasm -m 65536 "$$<" "$$@" -s $$$$tmpfile && \ - fasmdep -e $$$$tmpfile > .deps/$(4).Po && \ - rm $$$$tmpfile) || (rm $$$$tmpfile; false) --include .deps/$(4).Po -endef - -progname=$(call respace,$(basename $(notdir $(call binarypart,$(f))))) -binarydir=$(subst ./,,$(dir $(call binarypart,$(f)))) -$(foreach f,$(FASM_PROGRAMS) $(FASM_PROGRAMS_CD) $(SKIN_SOURCES),$(eval $(call fasm_meta_rule,$(fbinary),$(fsource),$(binarydir),$(progname)))) -$(foreach f,$(FASM_NOKPACK_PROGRAMS),$(eval $(call fasm_nokpack_meta_rule,$(fbinary),$(fsource),$(binarydir),$(progname)))) - -# Rule for the kernel differs: it uses kerpack instead of kpack. -kernel.mnt: $(KERNEL)/kernel.asm ../common/Makefile.fasm .deps/.dir - tmpfile=`mktemp --tmpdir build.XXXXXXXX` && \ - (fasm -m 131072 "$<" "$@" -s $$tmpfile && \ - fasmdep -e $$tmpfile > .deps/kernel.Po && \ - rm $$tmpfile) || (rm $$tmpfile; false) - kerpack "$@" --include .deps/kernel.Po diff --git a/data/common/Makefile.gcc b/data/common/Makefile.gcc deleted file mode 100644 index aa8e9002c0..0000000000 --- a/data/common/Makefile.gcc +++ /dev/null @@ -1,8 +0,0 @@ -define gcc_compile - win32-gcc -c -Os -DAUTOBUILD -DLANG_RUS=1 -o $@ $< -endef -define gcc_link - win32-ld -nostdlib -T $(1) -o "$@" $^ - win32-objcopy "$@" -O binary - kpack --nologo "$@" -endef diff --git a/data/common/Makefile.main b/data/common/Makefile.main deleted file mode 100644 index d4eddc4b1a..0000000000 --- a/data/common/Makefile.main +++ /dev/null @@ -1,880 +0,0 @@ -# This Makefile is included by root Makefiles of every build, -# root Makefiles set BUILD_TYPE correspondingly. -# Note that the current directory is data/$BUILD_TYPE, not data/common, -# so relative references like "file" are resolved as data/$BUILD_TYPE/file, -# not data/common/file. - -# General rule for naming: variables with CAPITALIZED names hold settings, -# you can - and are expected - to modify it; variables with lowercase names -# are intermediate variables and macroses not to be modified unless you -# know what you're doing. - -# Define directories for destination, source repository, sources of kernel, sources of programs. -BUILD_DIR:=build -REPOSITORY:=../.. -KERNEL:=$(REPOSITORY)/kernel/trunk -PROGS:=$(REPOSITORY)/programs - -# The main goal: build kolibri.img, kolibri.iso and list for creating a distribution kit -all: $(BUILD_DIR)/kolibri.img $(BUILD_DIR)/kolibri.iso $(BUILD_DIR)/distr.lst - -# Docpak requires some documents; we place them -# into 'docs' subdir and communicate with FASM -# through environment var DOCDIR. -DOCDIR:=docs/ -export DOCDIR - -# Because most programs are written in FASM and have -# the common structure of one main .asm file possibly including -# several .inc files, we handle this case separately. -# Namely, we organize one big list of such programs -# (FASM_PROGRAMS, see below) containing name of local binary file, -# name of file inside kolibri.img and name of the source file. -# This list is maintained by hand, and the rest is done with some macroses... -# well, slightly complicated macroses - however, you do not need to -# understand them in order to maintain the list. -# To add a FASM program with one .asm file, just -# add the corresponding item to the list and enjoy -# the power of GNU make. - -# The list of all FASM programs with one main FASM file. -# Every item consists of three parts, separated by ':'. -# First part is the real name of binary file in $(BUILD_DIR) -# as it should be produced by make. -# Second part is the name of a file inside kolibri.img, -# usually uppercased version of first part - to save space -# for FAT filesystem. -# Third part is the name of the source file. -# Spaces separate items, so spaces in names should be -# represented as '|'. -FASM_PROGRAMS:=\ - @menu:@MENU:$(PROGS)/system/menu/trunk/menu.asm \ - @panel:@PANEL:$(PROGS)/system/panel/trunk/@PANEL.ASM \ - @docky:@DOCKY:$(PROGS)/system/docky/trunk/docky.asm \ - @notify:@NOTIFY:$(PROGS)/system/notify3/notify.asm \ - @ss:@SS:$(PROGS)/system/ss/trunk/@ss.asm \ - refrscrn:REFRSCRN:$(PROGS)/system/refrscrn/refrscrn.asm \ - asciivju:ASCIIVJU:$(PROGS)/develop/asciivju/trunk/asciivju.asm \ - calc:CALC:$(PROGS)/other/calc/trunk/calc.asm \ - calendar:CALENDAR:$(PROGS)/system/calendar/trunk/calendar.asm \ - colrdial:COLRDIAL:$(PROGS)/system/colrdial/color_dialog.asm \ - loaddrv:LOADDRV:$(PROGS)/system/loaddrv/loaddrv.asm \ - cpu:CPU:$(PROGS)/system/cpu/trunk/cpu.asm \ - cpuid:CPUID:$(PROGS)/system/cpuid/trunk/CPUID.ASM \ - desktop:DESKTOP:$(PROGS)/system/desktop/trunk/desktop.asm \ - disptest:DISPTEST:$(PROGS)/system/disptest/trunk/disptest.ASM \ - docpack:DOCPACK:$(PROGS)/system/docpack/trunk/docpack.asm \ - end:END:$(PROGS)/system/end/light/end.asm \ - fspeed:FSPEED:$(PROGS)/fs/fspeed/fspeed.asm \ - gmon:GMON:$(PROGS)/system/gmon/gmon.asm \ - hdd_info:HDD_INFO:$(PROGS)/system/hdd_info/trunk/hdd_info.asm \ - @icon:@ICON:$(PROGS)/system/icon_new/@icon.asm \ - cropflat:CROPFLAT:$(PROGS)/system/cropflat/cropflat.asm \ - kbd:KBD:$(PROGS)/system/kbd/trunk/kbd.ASM \ - kpack:KPACK:$(PROGS)/other/kpack/trunk/kpack.asm \ - launcher:LAUNCHER:$(PROGS)/system/launcher/trunk/launcher.asm \ - magnify:MAGNIFY:$(PROGS)/demos/magnify/trunk/magnify.asm \ - mgb:MGB:$(PROGS)/system/mgb/trunk/mgb.asm \ - mousemul:MOUSEMUL:$(PROGS)/system/mousemul/trunk/mousemul.asm \ - madmouse:MADMOUSE:$(PROGS)/other/madmouse/madmouse.asm \ - mykey:MYKEY:$(PROGS)/system/MyKey/trunk/MyKey.asm \ - pcidev:PCIDEV:$(PROGS)/system/pcidev/trunk/PCIDEV.ASM \ - rdsave:RDSAVE:$(PROGS)/system/rdsave/trunk/rdsave.asm \ - rtfread:RTFREAD:$(PROGS)/other/rtfread/trunk/rtfread.asm \ - run:RUN:$(PROGS)/system/run/trunk/run.asm \ - searchap:SEARCHAP:$(PROGS)/system/searchap/searchap.asm \ - scrshoot:SCRSHOOT:$(PROGS)/media/scrshoot/scrshoot.asm \ - setup:SETUP:$(PROGS)/system/setup/trunk/setup.asm \ - test:TEST:$(PROGS)/system/test/trunk/test.asm \ - tinypad:TINYPAD:$(PROGS)/develop/tinypad/trunk/tinypad.asm \ - zkey:ZKEY:$(PROGS)/system/zkey/trunk/ZKEY.ASM \ - terminal:TERMINAL:$(PROGS)/system/terminal/terminal.asm \ - 3d/3dsheart:3D/3DSHEART:$(PROGS)/demos/3dsheart/trunk/3dsheart.asm \ - 3d/3dwav:3D/3DWAV:$(PROGS)/demos/3dwav/trunk/3dwav.asm \ - 3d/crownscr:3D/CROWNSCR:$(PROGS)/demos/crownscr/trunk/crownscr.asm \ - 3d/free3d04:3D/FREE3D04:$(PROGS)/demos/free3d04/trunk/free3d04.asm \ - 3d/view3ds:3D/VIEW3DS:$(PROGS)/demos/3DS/VIEW3DS.ASM \ - demos/bcdclk:DEMOS/BCDCLK:$(PROGS)/demos/bcdclk/trunk/bcdclk.asm \ - demos/circle:DEMOS/CIRCLE:$(PROGS)/develop/examples/circle/trunk/circle.asm \ - demos/colorref:DEMOS/COLORREF:$(PROGS)/demos/colorref/trunk/colorref.asm \ - demos/cslide:DEMOS/CSLIDE:$(PROGS)/demos/cslide/trunk/cslide.asm \ - demos/eyes:DEMOS/EYES:$(PROGS)/demos/eyes/trunk/eyes.asm \ - demos/firework:DEMOS/FIREWORK:$(PROGS)/demos/firework/trunk/firework.asm \ - demos/movback:DEMOS/MOVBACK:$(PROGS)/demos/movback/trunk/movback.asm \ - demos/plasma:DEMOS/PLASMA:$(PROGS)/demos/plasma/trunk/plasma.asm \ - demos/tinyfrac:DEMOS/TINYFRAC:$(PROGS)/demos/tinyfrac/trunk/tinyfrac.asm \ - demos/trantest:DEMOS/TRANTEST:$(PROGS)/demos/trantest/trunk/trantest.asm \ - demos/tube:DEMOS/TUBE:$(PROGS)/demos/tube/trunk/tube.asm \ - demos/unvwater:DEMOS/UNVWATER:$(PROGS)/demos/unvwater/trunk/unvwater.asm \ - demos/use_mb:DEMOS/USE_MB:$(PROGS)/demos/use_mb/use_mb.asm \ - demos/web:DEMOS/WEB:$(PROGS)/demos/web/trunk/web.asm \ - develop/board:DEVELOP/BOARD:$(PROGS)/system/board/trunk/board.asm \ - develop/cObj:DEVELOP/cObj:$(PROGS)/develop/cObj/trunk/cObj.asm \ - develop/fasm:DEVELOP/FASM:$(PROGS)/develop/fasm/trunk/fasm.asm \ - develop/h2d2b:DEVELOP/H2D2B:$(PROGS)/develop/h2d2b/trunk/h2d2b.asm \ - develop/heed:DEVELOP/HEED:$(PROGS)/develop/heed/trunk/heed.asm \ - develop/keyascii:DEVELOP/KEYASCII:$(PROGS)/develop/keyascii/trunk/keyascii.asm \ - develop/mtdbg:DEVELOP/MTDBG:$(PROGS)/develop/mtdbg/mtdbg.asm \ - develop/scancode:DEVELOP/SCANCODE:$(PROGS)/develop/scancode/trunk/scancode.asm \ - develop/t_edit:DEVELOP/T_EDIT:$(PROGS)/other/t_edit/t_edit.asm \ - develop/test_gets:DEVELOP/test_gets:$(PROGS)/develop/libraries/console/examples/test_gets.asm \ - develop/thread:DEVELOP/THREAD:$(PROGS)/develop/examples/thread/trunk/thread.asm \ - develop/info/asm.syn:DEVELOP/INFO/ASM.SYN:$(PROGS)/other/t_edit/info/asm_syn.asm \ - develop/info/cpp_kol_cla.syn:DEVELOP/INFO/CPP_KOL_CLA.SYN:$(PROGS)/other/t_edit/info/cpp_kol_cla_syn.asm \ - develop/info/cpp_kol_dar.syn:DEVELOP/INFO/CPP_KOL_DAR.SYN:$(PROGS)/other/t_edit/info/cpp_kol_dar_syn.asm \ - develop/info/cpp_kol_def.syn:DEVELOP/INFO/CPP_KOL_DEF.SYN:$(PROGS)/other/t_edit/info/cpp_kol_def_syn.asm \ - develop/info/default.syn:DEVELOP/INFO/DEFAULT.SYN:$(PROGS)/other/t_edit/info/default_syn.asm \ - develop/info/html.syn:DEVELOP/INFO/HTML.SYN:$(PROGS)/other/t_edit/info/html_syn.asm \ - develop/info/ini_files.syn:DEVELOP/INFO/INI_FILES.SYN:$(PROGS)/other/t_edit/info/ini_files_syn.asm \ - develop/info/win_const.syn:DEVELOP/INFO/WIN_CONST.SYN:$(PROGS)/other/t_edit/info/win_const_syn.asm \ - File|Managers/kfar:File|Managers/KFAR:$(PROGS)/fs/kfar/trunk/kfar.asm \ - File|Managers/kfm:File|Managers/KFM:$(PROGS)/fs/kfm/trunk/kfm.asm \ - File|Managers/opendial:File|Managers/OPENDIAL:$(PROGS)/fs/opendial/opendial.asm \ - games/15:GAMES/15:$(PROGS)/games/15/trunk/15.ASM \ - games/arcanii:GAMES/ARCANII:$(PROGS)/games/arcanii/trunk/arcanii.asm \ - games/freecell:GAMES/FREECELL:$(PROGS)/games/freecell/freecell.asm \ - games/gomoku:GAMES/GOMOKU:$(PROGS)/games/gomoku/trunk/gomoku.asm \ - games/invaders:GAMES/INVADERS:$(PROGS)/games/invaders/invaders.asm \ - games/klavisha:GAMES/KLAVISHA:$(PROGS)/games/klavisha/trunk/klavisha.asm \ - games/lines:GAMES/LINES:$(PROGS)/games/lines/lines.asm \ - games/mblocks:GAMES/MBLOCKS:$(PROGS)/games/mblocks/trunk/mblocks.asm \ - games/msquare:GAMES/MSQUARE:$(PROGS)/games/MSquare/trunk/MSquare.asm \ - games/phenix:GAMES/PHENIX:$(PROGS)/games/phenix/trunk/phenix.asm \ - games/pipes:GAMES/PIPES:$(PROGS)/games/pipes/pipes.asm \ - games/pong:GAMES/PONG:$(PROGS)/games/pong/trunk/pong.asm \ - games/pong3:GAMES/PONG3:$(PROGS)/games/pong3/trunk/pong3.asm \ - games/rsquare:GAMES/RSQUARE:$(PROGS)/games/rsquare/trunk/rsquare.asm \ - games/snake:GAMES/SNAKE:$(PROGS)/games/snake/trunk/snake.asm \ - games/sq_game:GAMES/SQ_GAME:$(PROGS)/games/sq_game/trunk/SQ_GAME.ASM \ - games/sudoku:GAMES/SUDOKU:$(PROGS)/games/sudoku/trunk/sudoku.asm \ - games/sw:GAMES/SW:$(PROGS)/games/sw/trunk/sw.asm \ - games/tanks:GAMES/TANKS:$(PROGS)/games/tanks/trunk/tanks.asm \ - games/tetris:GAMES/TETRIS:$(PROGS)/games/tetris/trunk/tetris.asm \ - lib/archiver.obj:LIB/ARCHIVER.OBJ:$(PROGS)/fs/kfar/trunk/kfar_arc/kfar_arc.asm \ - lib/box_lib.obj:LIB/BOX_LIB.OBJ:$(PROGS)/develop/libraries/box_lib/trunk/box_lib.asm \ - lib/buf2d.obj:LIB/BUF2D.OBJ:$(PROGS)/develop/libraries/buf2d/trunk/buf2d.asm \ - lib/console.obj:LIB/CONSOLE.OBJ:$(PROGS)/develop/libraries/console/console.asm \ - lib/libgfx.obj:LIB/LIBGFX.OBJ:$(PROGS)/develop/libraries/libs-dev/libgfx/libgfx.asm \ - lib/libimg.obj:LIB/LIBIMG.OBJ:$(PROGS)/develop/libraries/libs-dev/libimg/libimg.asm \ - lib/libini.obj:LIB/LIBINI.OBJ:$(PROGS)/develop/libraries/libs-dev/libini/libini.asm \ - lib/libio.obj:LIB/LIBIO.OBJ:$(PROGS)/develop/libraries/libs-dev/libio/libio.asm \ - lib/msgbox.obj:LIB/MSGBOX.OBJ:$(PROGS)/develop/libraries/msgbox/msgbox.asm \ - lib/network.obj:LIB/NETWORK.OBJ:$(PROGS)/develop/libraries/network/network.asm \ - lib/sort.obj:LIB/SORT.OBJ:$(PROGS)/develop/libraries/sorter/sort.asm \ - lib/http.obj:LIB/HTTP.OBJ:$(PROGS)/develop/libraries/http/http.asm \ - lib/proc_lib.obj:LIB/PROC_LIB.OBJ:$(PROGS)/develop/libraries/proc_lib/trunk/proc_lib.asm \ - lib/cnv_png.obj:LIB/CNV_PNG.OBJ:$(PROGS)/media/zsea/plugins/png/cnv_png.asm \ - media/animage:MEDIA/ANIMAGE:$(PROGS)/media/animage/trunk/animage.asm \ - media/kiv:MEDIA/KIV:$(PROGS)/media/kiv/trunk/kiv.asm \ - media/listplay:MEDIA/LISTPLAY:$(PROGS)/media/listplay/trunk/listplay.asm \ - media/midamp:MEDIA/MIDAMP:$(PROGS)/media/midamp/trunk/midamp.asm \ - media/palitra:MEDIA/PALITRA:$(PROGS)/media/palitra/trunk/palitra.asm \ - media/startmus:MEDIA/STARTMUS:$(PROGS)/media/startmus/trunk/STARTMUS.ASM \ - network/ping:NETWORK/PING:$(PROGS)/network/icmp/ping.asm \ - network/netcfg:NETWORK/NETCFG:$(PROGS)/network/netcfg/netcfg.asm \ - network/netstat:NETWORK/NETSTAT:$(PROGS)/network/netstat/netstat.asm \ - network/nslookup:NETWORK/NSLOOKUP:$(PROGS)/network/nslookup/nslookup.asm \ - network/pasta:NETWORK/PASTA:$(PROGS)/network/pasta/pasta.asm \ - network/synergyc:NETWORK/SYNERGYC:$(PROGS)/network/synergyc/synergyc.asm \ - network/tcpserv:NETWORK/TCPSERV:$(PROGS)/network/tcpserv/tcpserv.asm \ - network/telnet:NETWORK/TELNET:$(PROGS)/network/telnet/telnet.asm \ - network/zeroconf:NETWORK/ZEROCONF:$(PROGS)/network/zeroconf/zeroconf.asm \ - network/ftpc:NETWORK/FTPC:$(PROGS)/network/ftpc/ftpc.asm \ - network/ftpd:NETWORK/FTPD:$(PROGS)/network/ftpd/ftpd.asm \ - network/tftpc:NETWORK/TFTPC:$(PROGS)/network/tftpc/tftpc.asm \ - network/ircc:NETWORK/IRCC:$(PROGS)/network/ircc/ircc.asm \ - network/downloader:NETWORK/DOWNLOADER:$(PROGS)/network/downloader/downloader.asm \ -# end of list -# For russian build, add russian-only programs. -ifeq ($(BUILD_TYPE),rus) -FASM_PROGRAMS:=$(FASM_PROGRAMS) \ - period:PERIOD:$(PROGS)/other/period/trunk/period.asm \ - develop/testcon2:DEVELOP/TESTCON2:$(PROGS)/develop/libraries/console/examples/testcon2_rus.asm \ -# end of list -else -FASM_PROGRAMS:=$(FASM_PROGRAMS) \ - develop/testcon2:DEVELOP/TESTCON2:$(PROGS)/develop/libraries/console/examples/testcon2_eng.asm \ - games/soko:GAMES/SOKO:$(PROGS)/games/soko/trunk/SOKO.ASM \ -# end of list -endif -# Same as above with PE stripping as extra step. -FASM_PROGRAMS_PESTRIP:=\ - drivers/vidintel.sys:DRIVERS/VIDINTEL.SYS:$(REPOSITORY)/drivers/video/vidintel.asm \ - drivers/3c59x.sys:DRIVERS/3C59X.SYS:$(REPOSITORY)/drivers/ethernet/3c59x.asm \ - drivers/dec21x4x.sys:DRIVERS/DEC21X4X.SYS:$(REPOSITORY)/drivers/ethernet/dec21x4x.asm \ - drivers/forcedeth.sys:DRIVERS/FORCEDETH.SYS:$(REPOSITORY)/drivers/ethernet/forcedeth.asm \ - drivers/i8254x.sys:DRIVERS/I8254X.SYS:$(REPOSITORY)/drivers/ethernet/i8254x.asm \ - drivers/i8255x.sys:DRIVERS/I8255X.SYS:$(REPOSITORY)/drivers/ethernet/i8255x.asm \ - drivers/mtd80x.sys:DRIVERS/MTD80X.SYS:$(REPOSITORY)/drivers/ethernet/mtd80x.asm \ - drivers/pcnet32.sys:DRIVERS/PCNET32.SYS:$(REPOSITORY)/drivers/ethernet/pcnet32.asm \ - drivers/r6040.sys:DRIVERS/R6040.SYS:$(REPOSITORY)/drivers/ethernet/R6040.asm \ - drivers/rhine.sys:DRIVERS/RHINE.SYS:$(REPOSITORY)/drivers/ethernet/rhine.asm \ - drivers/rtl8029.sys:DRIVERS/RTL8029.SYS:$(REPOSITORY)/drivers/ethernet/RTL8029.asm \ - drivers/rtl8139.sys:DRIVERS/RTL8139.SYS:$(REPOSITORY)/drivers/ethernet/RTL8139.asm \ - drivers/rtl8169.sys:DRIVERS/RTL8169.SYS:$(REPOSITORY)/drivers/ethernet/RTL8169.asm \ - drivers/sis900.sys:DRIVERS/SIS900.SYS:$(REPOSITORY)/drivers/ethernet/sis900.asm \ - drivers/uhci.sys:DRIVERS/UHCI.SYS:$(REPOSITORY)/drivers/usb/uhci.asm \ - drivers/ohci.sys:DRIVERS/OHCI.SYS:$(REPOSITORY)/drivers/usb/ohci.asm \ - drivers/ehci.sys:DRIVERS/EHCI.SYS:$(REPOSITORY)/drivers/usb/ehci.asm \ - drivers/usbhid.sys:DRIVERS/USBHID.SYS:$(REPOSITORY)/drivers/usb/usbhid/usbhid.asm \ - drivers/usbstor.sys:DRIVERS/USBSTOR.SYS:$(REPOSITORY)/drivers/usb/usbstor.asm \ - drivers/rdc.sys:DRIVERS/RDC.SYS:$(REPOSITORY)/drivers/video/rdc.asm \ - drivers/commouse.sys:DRIVERS/COMMOUSE.SYS:$(REPOSITORY)/drivers/mouse/commouse.asm \ - drivers/ps2mouse.sys:DRIVERS/PS2MOUSE.SYS:$(REPOSITORY)/drivers/mouse/ps2mouse4d/trunk/ps2mouse.asm \ - drivers/tmpdisk.sys:DRIVERS/TMPDISK.SYS:$(REPOSITORY)/drivers/disk/tmpdisk.asm \ - drivers/intel_hda.sys:DRIVERS/intel_hda.sys:$(REPOSITORY)/drivers/audio/intel_hda/intel_hda.asm \ - drivers/sb16.sys:DRIVERS/SB16.SYS:$(REPOSITORY)/drivers/audio/sb16/sb16.asm \ - drivers/sound.sys:DRIVERS/SOUND.SYS:$(REPOSITORY)/drivers/audio/sound.asm \ - drivers/infinity.sys:DRIVERS/INFINITY.SYS:$(REPOSITORY)/drivers/audio/infinity/infinity.asm \ - drivers/intelac97.sys:DRIVERS/INTELAC97.SYS:$(REPOSITORY)/drivers/audio/intelac97.asm \ - drivers/emu10k1x.sys:DRIVERS/EMU10K1X.SYS:$(REPOSITORY)/drivers/audio/emu10k1x.asm \ - drivers/fm801.sys:DRIVERS/FM801.SYS:$(REPOSITORY)/drivers/audio/fm801.asm \ - drivers/vt823x.sys:DRIVERS/VT823X.SYS:$(REPOSITORY)/drivers/audio/vt823x.asm \ - drivers/sis.sys:DRIVERS/SIS.SYS:$(REPOSITORY)/drivers/audio/sis.asm \ -# end of list -# The list of all FASM programs with one main FASM file for CD image. -# Format of an item is exactly the same as in the previous list. -FASM_PROGRAMS_CD:=\ - drivers/atikms:DRIVERS/ATIKMS:$(REPOSITORY)/drivers/video/drm/radeon/atikms.asm \ - distr_data/zsea:DISTR_DATA/ZSEA:$(PROGS)/media/zsea/zSea.asm \ - distr_data/cnv_bmp.obj:DISTR_DATA/CNV_BMP.OBJ:$(PROGS)/media/zsea/plugins/bmp/cnv_bmp.asm \ - distr_data/cnv_gif.obj:DISTR_DATA/CNV_GIF.OBJ:$(PROGS)/media/zsea/plugins/gif/cnv_gif.asm \ - distr_data/cnv_jpeg.obj:DISTR_DATA/CNV_JPEG.OBJ:$(PROGS)/media/zsea/plugins/jpeg/cnv_jpeg.asm \ - distr_data/convert.obj:DISTR_DATA/CONVERT.OBJ:$(PROGS)/media/zsea/plugins/convert/convert.asm \ - distr_data/rotate.obj:DISTR_DATA/ROTATE.OBJ:$(PROGS)/media/zsea/plugins/rotate/rotate.asm \ - distr_data/scaling.obj:DISTR_DATA/SCALING.OBJ:$(PROGS)/media/zsea/plugins/scaling/scaling.asm \ -# end of list - -# The list of all FASM programs which needs to be compiled without KPACKing. -FASM_NOKPACK_PROGRAMS:=\ - distr_data/9x2klbr.exe:-:$(PROGS)/hd_load/9x2klbr/9x2klbr.asm \ - distr_data/MeOSload.com:-:$(PROGS)/hd_load/meosload/MeOSload.asm \ - distr_data/mtldr:-:$(PROGS)/hd_load/mtldr/mtldr.asm \ - mtldr_for_installer:-:$(PROGS)/hd_load/mtldr_install/mtldr_code/mtldr.asm \ - distr_data/mtldr_install.exe:-:$(PROGS)/hd_load/mtldr_install/mtldr_install.asm \ - distr_data/MeOSload_for_usb_boot_old.com:-:$(PROGS)/hd_load/usb_boot_old/MeOSload.asm \ - distr_data/enable_for_usb_boot_old.exe:-:$(PROGS)/hd_load/usb_boot_old/enable.asm \ - distr_data/BOOT_F32.BIN:-:$(PROGS)/hd_load/usb_boot/BOOT_F32.ASM \ - distr_data/MTLD_F32:-:$(PROGS)/hd_load/usb_boot/mtldr.asm \ - distr_data/inst.exe:-:$(PROGS)/hd_load/usb_boot/inst.asm \ - distr_data/setmbr.exe:-:$(PROGS)/hd_load/usb_boot/setmbr.asm \ -#end of list - -# The list of all NASM programs with one main NASM file. -# Format of an item is exactly the same as in the previous list. -NASM_PROGRAMS:=\ - demos/aclock:DEMOS/ACLOCK:$(PROGS)/demos/aclock/trunk/aclock.asm \ - demos/timer:DEMOS/TIMER:$(PROGS)/other/Timer/Timer.asm \ - games/c4:GAMES/C4:$(PROGS)/games/c4/trunk/c4.asm \ - tinfo:TINFO:$(PROGS)/system/tinfo/tinfo.asm \ - develop/mstate:DEVELOP/MSTATE:$(PROGS)/develop/mstate/mstate.asm \ -# end of list - -# The list of files which should be copied from somewhere. -# Format of an item is exactly the same as in the previous list. -COPY_FILES:=\ - macros.inc:MACROS.INC:$(PROGS)/macros.inc \ - config.inc:CONFIG.INC:$(PROGS)/config.inc \ - struct.inc:STRUCT.INC:$(PROGS)/struct.inc \ - develop/te_icon.png:DEVELOP/TE_ICON.PNG:$(PROGS)/other/t_edit/te_icon.png \ - develop/tl_nod_16.png:DEVELOP/TL_NOD_16.PNG:$(PROGS)/other/t_edit/tl_nod_16.png \ - develop/tl_sys_16.png:DEVELOP/TL_SYS_16.PNG:$(PROGS)/media/log_el/trunk/tl_sys_16.png \ - develop/t_edit.ini:DEVELOP/T_EDIT.INI:$(PROGS)/other/t_edit/t_edit.ini \ - File|Managers/z_icons.png:File|Managers/Z_ICONS.PNG:$(PROGS)/fs/opendial/z_icons.png \ - File|Managers/buttons.bmp:File|Managers/BUTTONS.BMP:$(PROGS)/fs/kfm/trunk/buttons.bmp \ - File|Managers/icons.bmp:File|Managers/ICONS.BMP:$(PROGS)/fs/kfm/trunk/icons.bmp \ - fonts/litt.chr:FONTS/LITT.CHR:$(PROGS)/demos/bgitest/trunk/FONTS/LITT.CHR \ - games/snake.ini:GAMES/SNAKE.INI:$(PROGS)/games/snake/trunk/snake.ini \ - media/kiv.ini:MEDIA/KIV.INI:$(PROGS)/media/kiv/trunk/kiv.ini \ - network/wv_skin.png:NETWORK/WV_SKIN.PNG:$(PROGS)/cmm/browser/wv_skin.png \ -# end of list -ifeq ($(BUILD_TYPE),rus) -COPY_FILES:=$(COPY_FILES) \ - File|Managers/kfm_keys.txt:File|Managers/KFM_KEYS.TXT:$(PROGS)/fs/kfm/trunk/docs/russian/dos_kolibri/kfm_keys.txt \ - settings/.shell:SETTINGS/.shell:$(PROGS)/system/shell/bin/rus/.shell \ - settings/mykey.ini:SETTINGS/MYKEY.INI:$(PROGS)/system/MyKey/trunk/mykey.ini \ - example.asm:EXAMPLE.ASM:$(PROGS)/develop/examples/example/trunk/rus/example.asm \ -# end of list -else -COPY_FILES:=$(COPY_FILES) \ - File|Managers/kfm_keys.txt:File|Managers/KFM_KEYS.TXT:$(PROGS)/fs/kfm/trunk/docs/english/kfm_keys.txt \ - games/skin.raw:GAMES/SKIN.RAW:$(PROGS)/games/soko/trunk/SKIN.RAW \ - games/soko-4.lev:GAMES/SOKO-4.LEV:$(PROGS)/games/soko/trunk/SOKO-4.LEV \ - games/soko-5.lev:GAMES/SOKO-5.LEV:$(PROGS)/games/soko/trunk/SOKO-5.LEV \ - games/soko-6.lev:GAMES/SOKO-6.LEV:$(PROGS)/games/soko/trunk/SOKO-6.LEV \ - games/soko-7.lev:GAMES/SOKO-7.LEV:$(PROGS)/games/soko/trunk/SOKO-7.LEV \ - games/soko-8.lev:GAMES/SOKO-8.LEV:$(PROGS)/games/soko/trunk/SOKO-8.LEV \ - games/soko-9.lev:GAMES/SOKO-9.LEV:$(PROGS)/games/soko/trunk/SOKO-9.LEV \ - settings/.shell:SETTINGS/.shell:$(PROGS)/system/shell/bin/eng/.shell \ - example.asm:EXAMPLE.ASM:$(PROGS)/develop/examples/example/trunk/example.asm \ -# end of list -ifeq ($(BUILD_TYPE),it) -COPY_FILES:=$(COPY_FILES) \ - settings/mykey.ini:SETTINGS/MYKEY.INI:$(PROGS)/system/MyKey/trunk/mykey_it.ini -else -COPY_FILES:=$(COPY_FILES) \ - settings/mykey.ini:SETTINGS/MYKEY.INI:$(PROGS)/system/MyKey/trunk/mykey.ini -endif -endif - -# The list of all C-- programs with one main C-- file. -# Format of an item is exactly the same as in the previous list, -# except that there can be fourth field with parameters for a compiler. -CMM_PROGRAMS:=\ - File|Managers/eolite:File|Managers/EOLITE:$(PROGS)/cmm/eolite/Eolite.c \ - games/clicks:GAMES/CLICKS:$(PROGS)/games/clicks/trunk/clicks.c \ - games/FindNumbers:GAMES/FindNumbers:$(PROGS)/games/FindNumbers/trunk/FindNumbers.c-- \ - games/flood-it:GAMES/flood-it:$(PROGS)/games/flood-it/trunk/flood-it.c \ - games/mine:GAMES/MINE:$(PROGS)/games/mine/trunk/mine.c--:/MEOS \ - network/WebView:network/WebView:$(PROGS)/cmm/browser/WebView.c \ - tmpdisk:tmpdisk:$(PROGS)/cmm/tmpdisk/tmpdisk.c \ -# end of list - -# List of other files to be included in the image file. -# Some of them are auto-built with special rules, some just exist before build. -# Each item is of the form :. -# Spaces should be represented as |. -# -OTHER_FILES:=settings/autorun.dat:SETTINGS/AUTORUN.DAT \ - default.skn:DEFAULT.SKN \ - graph:GRAPH \ - settings/icon.ini:SETTINGS/ICON.INI \ - ../common/iconstrp.png:ICONSTRP.PNG index_htm:INDEX.HTM \ - kernel.mnt:KERNEL.MNT \ - ../common/kerpack:KERPACK \ - settings/keymap.key:SETTINGS/KEYMAP.KEY \ - settings/lang.ini:SETTINGS/LANG.INI \ - ../common/kuzkina.mid:KUZKINA.MID lang.inc:LANG.INC \ - settings/menu.dat:SETTINGS/MENU.DAT \ - settings/kolibri.lbl:SETTINGS/KOLIBRI.LBL \ - settings/panel.ini:SETTINGS/PANEL.INI \ - ../common/settings/docky.ini:SETTINGS/DOCKY.INI \ - ../common/notify3.png:NOTIFY3.PNG \ - settings/setup.dat:SETTINGS/SETUP.DAT \ - shell:SHELL table:TABLE \ - ../common/vmode:VMODE \ - ../common/3d/cubeline:3D/CUBELINE \ - ../common/3d/gears:3D/GEARS \ - ../common/3d/house.3ds:3D/HOUSE.3DS \ - ../common/demos/ak47.lif:DEMOS/AK47.LIF \ - ../common/demos/life2:DEMOS/LIFE2 \ - ../common/demos/relay.lif:DEMOS/RELAY.LIF \ - ../common/demos/rpento.lif:DEMOS/RPENTO.LIF \ - ../common/File|Managers/eolite.ini:File|Managers/EOLITE.INI \ - ../common/File|Managers/icons.ini:File|Managers/ICONS.INI \ - ../common/File|Managers/kfm.ini:File|Managers/KFM.INI \ - games/checkers:GAMES/CHECKERS \ - games/megamaze:GAMES/MEGAMAZE \ - games/reversi:GAMES/REVERSI games/rforces:GAMES/RFORCES \ - games/xonix:GAMES/XONIX \ - games/kosilka:GAMES/KOSILKA \ - ../common/lib/pixlib.obj:LIB/PIXLIB.OBJ \ - ../common/lib/iconv.obj:LIB/ICONV.OBJ \ - ../common/lib/netcode.obj:LIB/NETCODE.OBJ \ - media/ac97snd:MEDIA/AC97SND \ - ../common/media/ImgF/ImgF:MEDIA/ImgF/ImgF \ - ../common/media/ImgF/cEdg.obj:MEDIA/ImgF/cEdg.obj \ - ../common/media/ImgF/dither.obj:MEDIA/ImgF/dither.obj \ - ../common/media/ImgF/invSol.obj:MEDIA/ImgF/invSol.obj \ - settings/network.ini:SETTINGS/NETWORK.INI \ - ../common/network/ftpd.ini:NETWORK/FTPD.INI \ - ../common/network/users.ini:NETWORK/USERS.INI \ -#end of list -ifeq ($(BUILD_TYPE),rus) -OTHER_FILES:=$(OTHER_FILES) \ - pipetka:PIPETKA \ - File|Managers/kfar.ini:File|Managers/KFAR.INI \ - games/appdata.dat:GAMES/APPDATA.DAT games/ataka:GAMES/ATAKA \ - games/basekurs.kla:GAMES/BASEKURS.KLA \ - games/padenie:GAMES/PADENIE \ - games/whowtbam:GAMES/WHOWTBAM \ -#end of list -else -OTHER_FILES:=$(OTHER_FILES) \ - ../common/File|Managers/kfar.ini:File|Managers/KFAR.INI \ -#end of list -endif -#3d/logio.bmp:3D/LOGIO.BMP 3d/cubetext:3D/CUBETEXT - -# Generate skins list understandable by gnu make -Makefile.skins: $(REPOSITORY)/skins/authors.txt $(REPOSITORY)/data/generate_makefile_skins.sh - cut -f1 $< | $(SHELL) $(REPOSITORY)/data/generate_makefile_skins.sh > $@ -include Makefile.skins - -# Extra targets for the distribution kit and LiveCD image in the syntax of mkisofs -EXTRA:=\ - /=distr_data/autorun.inf \ - /=distr_data/KolibriOS_icon.ico \ - Skins/=$(REPOSITORY)/skins/authors.txt \ - Docs/stack.txt=docs/STACK.TXT \ - HD_Load/9x2klbr/=distr_data/9x2klbr.exe \ - HD_Load/9x2klbr/=../common/HD_load/9x2klbr/LDKLBR.VXD \ - HD_Load/MeOSLoad/=distr_data/MeOSload.com \ - HD_Load/MeOSLoad/=$(PROGS)/hd_load/meosload/AUTOEXEC.BAT \ - HD_Load/MeOSLoad/=$(PROGS)/hd_load/meosload/CONFIG.SYS \ - HD_Load/MeOSLoad/=$(PROGS)/hd_load/meosload/L_readme.txt \ - HD_Load/MeOSLoad/=$(PROGS)/hd_load/meosload/L_readme_Win.txt \ - HD_Load/mtldr/=distr_data/mtldr \ - HD_Load/mtldr/=$(PROGS)/hd_load/mtldr/vista_install.bat \ - HD_Load/mtldr/=$(PROGS)/hd_load/mtldr/vista_remove.bat \ - HD_Load/=distr_data/mtldr_install.exe \ - HD_Load/memdisk=../common/HD_load/memdisk \ - HD_Load/USB_Boot/=distr_data/BOOT_F32.BIN \ - HD_Load/USB_Boot/=distr_data/MTLD_F32 \ - HD_Load/USB_Boot/=distr_data/inst.exe \ - HD_Load/USB_Boot/=distr_data/setmbr.exe \ - HD_Load/USB_boot_old/=$(PROGS)/hd_load/usb_boot_old/usb_boot.rtf \ - HD_Load/USB_boot_old/=$(PROGS)/hd_load/usb_boot_old/usb_boot_866.txt \ - HD_Load/USB_boot_old/=$(PROGS)/hd_load/usb_boot_old/usb_boot_1251.txt \ - HD_Load/USB_boot_old/MeOSload.com=distr_data/MeOSload_for_usb_boot_old.com \ - HD_Load/USB_boot_old/enable.exe=distr_data/enable_for_usb_boot_old.exe \ - games/pig=../common/games/pig \ - games/soko/soko=games/soko \ - games/soko=../common/games/soko/ \ - kolibrios/emul/dosbox=../common/emul/DosBox \ - kolibrios/emul/fceu=../common/emul/fceu \ - kolibrios/emul/e80/e80=e80 \ - kolibrios/emul/gameboy=../common/emul/gameboy \ - kolibrios/emul/scummvm=../common/emul/scummvm \ - kolibrios/emul/zsnes=../common/emul/zsnes \ - kolibrios/games/doom=../common/games/doom \ - kolibrios/games/fara/fara=games/fara \ - kolibrios/games/fara/fara.gfx=../common/games/fara.gfx \ - kolibrios/games/jumpbump=../common/games/jumpbump \ - kolibrios/games/quake=../common/games/quake \ - kolibrios/games/lrl=../common/games/lrl \ - kolibrios/lib/avcodec-55.dll=../common/lib/avcodec-55.dll \ - kolibrios/lib/avdevice-55.dll=../common/lib/avdevice-55.dll \ - kolibrios/lib/avformat-55.dll=../common/lib/avformat-55.dll \ - kolibrios/lib/avutil-52.dll=../common/lib/avutil-52.dll \ - kolibrios/lib/freetype.dll=../common/lib/freetype.dll \ - kolibrios/lib/libc.dll=../common/lib/libc.dll \ - kolibrios/lib/pixlib.dll=../common/lib/pixlib.dll \ - kolibrios/lib/swresample-0.dll=../common/lib/swresample-0.dll \ - kolibrios/lib/swscale-2.dll=../common/lib/swscale-2.dll \ - kolibrios/lib/zlib.dll=../common/lib/zlib.dll \ - kolibrios/media/fplay-full=../common/media/fplay-full \ - kolibrios/media/zsea/zsea=distr_data/zsea \ - kolibrios/media/zsea/plugins/cnv_bmp.obj=distr_data/cnv_bmp.obj \ - kolibrios/media/zsea/plugins/cnv_gif.obj=distr_data/cnv_gif.obj \ - kolibrios/media/zsea/plugins/cnv_jpeg.obj=distr_data/cnv_jpeg.obj \ - kolibrios/media/zsea/plugins/convert.obj=distr_data/convert.obj \ - kolibrios/media/zsea/plugins/rotate.obj=distr_data/rotate.obj \ - kolibrios/media/zsea/plugins/scaling.obj=distr_data/scaling.obj \ - kolibrios/media/zsea/zsea.ini=$(REPOSITORY)/programs/media/zsea/zSea.ini \ - kolibrios/media/zsea/buttons/buttons.png=$(REPOSITORY)/programs/media/zsea/buttons.png \ -#end of list -ifeq ($(BUILD_TYPE),rus) -EXTRA:=$(EXTRA) \ - Docs/cp866/config.txt=docs/CONFIG.TXT \ - Docs/cp866/gnu.txt=docs/GNU.TXT \ - Docs/cp866/history.txt=docs/HISTORY.TXT \ - Docs/cp866/hot_keys.txt=docs/HOT_KEYS.TXT \ - Docs/cp866/install.txt=docs/INSTALL.TXT \ - Docs/cp866/readme.txt=docs/README.TXT \ - Docs/cp866/sysfuncr.txt=docs/SYSFUNCR.TXT \ - Docs/cp1251/config.txt=docs/CONFIG.WIN.TXT \ - Docs/cp1251/gnu.txt=docs/GNU.WIN.TXT \ - Docs/cp1251/history.txt=docs/HISTORY.WIN.TXT \ - Docs/cp1251/hot_keys.txt=docs/HOT_KEYS.WIN.TXT \ - Docs/cp1251/install.txt=docs/INSTALL.WIN.TXT \ - Docs/cp1251/readme.txt=docs/README.WIN.TXT \ - Docs/cp1251/sysfuncr.txt=docs/SYSFUNCR.WIN.TXT \ - HD_Load/9x2klbr/=$(PROGS)/hd_load/9x2klbr/readme_dos.txt \ - HD_Load/9x2klbr/=$(PROGS)/hd_load/9x2klbr/readme_win.txt \ - HD_Load/mtldr/=$(PROGS)/hd_load/mtldr/install.txt \ - HD_Load/USB_Boot/=$(PROGS)/hd_load/usb_boot/readme.txt \ - kolibrios/media/zsea/zsea_keys.txt=$(REPOSITORY)/programs/media/zsea/Docs/zSea_keys_rus.txt \ -#end of list -else -EXTRA:=$(EXTRA) \ - Docs/config.txt=docs/CONFIG.TXT \ - Docs/copying.txt=docs/COPYING.TXT \ - Docs/hot_keys.txt=docs/HOT_KEYS.TXT \ - Docs/install.txt=docs/INSTALL.TXT \ - Docs/readme.txt=docs/README.TXT \ - Docs/sysfuncs.txt=docs/SYSFUNCS.TXT \ - HD_Load/9x2klbr/=$(PROGS)/hd_load/9x2klbr/readme.txt \ - HD_Load/mtldr/install.txt=$(PROGS)/hd_load/mtldr/install_eng.txt \ - HD_Load/USB_Boot/readme.txt=$(PROGS)/hd_load/usb_boot/readme_eng.txt \ - kolibrios/media/zsea/zsea_keys.txt=$(REPOSITORY)/programs/media/zsea/Docs/zSea_keys_eng.txt \ -#end of list -endif -DISTRIBUTION_EXTRA:=\ - $(EXTRA) \ - /readme.txt=distr_data/readme_distr.txt \ - /kolibri.lbl=settings/kolibri.lbl \ -#end of list -MKISOFS_EXTRA:=\ - $(EXTRA) \ - /=distr_data/readme.txt \ - /=settings/kolibri.lbl \ -#end of list -ifeq ($(BUILD_TYPE),rus) -DISTRIBUTION_EXTRA:=$(DISTRIBUTION_EXTRA) \ - /readme_dos.txt=distr_data/readme_dos_distr.txt \ -#end of list -MKISOFS_EXTRA:=$(MKISOFS_EXTRA) \ - /=distr_data/readme_dos.txt \ -#end of list -endif - -ifeq ($(BUILD_TYPE),rus) -# Text files which need to be recoded to cp1251 from native aka cp866 -RECODE_TEXT_FILES:=\ - distr_data/readme.txt:distr_data/readme_dos.txt \ - distr_data/readme_distr.txt:distr_data/readme_dos_distr.txt \ - docs/CONFIG.WIN.TXT:docs/CONFIG.TXT \ - docs/GNU.WIN.TXT:docs/GNU.TXT \ - docs/HISTORY.WIN.TXT:docs/HISTORY.TXT \ - docs/HOT_KEYS.WIN.TXT:docs/HOT_KEYS.TXT \ - docs/INSTALL.WIN.TXT:docs/INSTALL.TXT \ - docs/README.WIN.TXT:docs/README.TXT \ - docs/SYSFUNCR.WIN.TXT:docs/SYSFUNCR.TXT \ -#end of list -endif - -# Some macro for convenient work. -# Macros for replacing '|' to escaped space '\ '. -space:=\ #plus space -respace=$(subst |,$(space),$(1)) -# Macro for selecting different parts of ':'-separated items. -binarypart=$(word 1,$(subst :, ,$(1))) -imagepart=$(word 2,$(subst :, ,$(1))) -sourcepart=$(word 3,$(subst :, ,$(1))) -parampart=$(word 4,$(subst :, ,$(1))) -# Get file names, possibly with spaces inside, from an item. -# Here $(f) is an item - in fact, macro argument. -fbinary=$(call respace,$(call binarypart,$(f))) -fimage=$(call respace,$(call imagepart,$(f))) -fsource=$(call respace,$(call sourcepart,$(f))) -fparam=$(call respace,$(call parampart,$(f))) - -# Add stripped PE files produced by fasm to FASM_NOKPACK_PROGRAMS. -include ../common/Makefile.pestrip -FASM_NOKPACK_PROGRAMS:=$(FASM_NOKPACK_PROGRAMS) \ - $(foreach f,$(FASM_PROGRAMS_PESTRIP),$(fbinary).full:-:$(fsource)) -$(foreach f,$(FASM_PROGRAMS_PESTRIP),$(eval $(call pestrip_meta_rule,$(fbinary),$(fbinary).full))) - -# Define targets for image file. -# Join all the lists above. -targets_full:=$(COPY_FILES) $(FASM_PROGRAMS) $(FASM_PROGRAMS_PESTRIP) $(NASM_PROGRAMS) $(OTHER_FILES) $(CMM_PROGRAMS) -# For each item in the united list call fbinary. -targets:=$(foreach f,$(targets_full),$(fbinary)) - -# Define a command for copying a file inside the image. -# mcopy_command is a macro with two parameters, -# local file name $(1) and image file name $(2). -# Note that spaces in these have to be escaped with backslashes. -mcopy_command=mcopy -moi $(BUILD_DIR)/kolibri.img $(1) ::$(2) -# Specialize a previous command for an item $(f) in one of lists. -mcopy_item_command=$(call mcopy_command,$(fbinary),$(fimage)) - -# Join all $(mcopy_item_command) for all items, -# append newline after each item. -# The first newline character after "define" line and -# the last newline character before "endef" line get away -# with define/endef, so we make three newline characters, -# that is two empty lines, in order to get one in $(newline). -define newline - - -endef -mcopy_all_items:=$(foreach f,$(targets_full),$(mcopy_item_command)$(newline)) - -# add skins to MKISOFS_EXTRA and DISTRIBUTION_EXTRA -allskins:=$(foreach f,$(SKIN_SOURCES),$(call imagepart,$(f))=$(call binarypart,$(f))) -MKISOFS_EXTRA:=$(MKISOFS_EXTRA) $(allskins) -DISTRIBUTION_EXTRA:=$(DISTRIBUTION_EXTRA) $(allskins) -# dependencies of MKISOFS_EXTRA; we iterate through $(MKISOFS_EXTRA), -# substitute "=" with space, get the 2nd word and join all results -mkisofs_extra_targets:=$(call respace,$(foreach f,$(MKISOFS_EXTRA),$(word 2,$(subst =, ,$(f))))) -distribution_extra_targets:=$(call respace,$(foreach f,$(DISTRIBUTION_EXTRA),$(word 2,$(subst =, ,$(f))))) - -# Define a command for creating a symlink for an item in DISTRIBUTION_EXTRA. -extra_item_dst=distribution_kit/$(word 1,$(subst =, ,$(f))) -extra_item_src=$(word 2,$(subst =, ,$(f))) -makelink_item_command=$(if $(notdir $(extra_item_src)), \ - ln -sr $(extra_item_src) $(extra_item_dst), \ - ln -sr $(extra_item_src)* $(extra_item_dst) \ - ) -# Join all $(makelink_command) for all items from DISTRIBUTION_EXTRA. -make_distribution_links:=$(foreach f,$(DISTRIBUTION_EXTRA),$(makelink_item_command)$(newline)) -# Define a command for creating all directories for DISTRIBUTION_EXTRA. -# Note that $(sort) removes duplicate entries. -distribution_dirs:=$(sort $(foreach f,$(DISTRIBUTION_EXTRA),$(dir distribution_kit/$(word 1,$(subst =, ,$(f)))))) -make_distribution_dirs:=$(foreach f,$(distribution_dirs),mkdir -p $(f)$(newline)) - -# The first goal: floppy image. -$(BUILD_DIR)/kolibri.img: $(BUILD_DIR)/.dir \ - Makefile ../common/Makefile.main \ - $(BUILD_DIR)/boot_fat12.bin \ - $(targets) -ifeq ($(BUILD_TYPE),rus) - str=`LANG=ru_RU.utf8 date -u +"[автосборка %d %b %Y %R, r$(REV)]"|iconv -f utf8 -t cp866`; \ - echo -n $$str|dd of=kernel.mnt bs=1 seek=`expr 279 - length "$$str"` conv=notrunc 2>/dev/null -else - str=`date -u +"[auto-build %d %b %Y %R, r$(REV)]"`; \ - echo -n $$str|dd of=kernel.mnt bs=1 seek=`expr 279 - length "$$str"` conv=notrunc 2>/dev/null -endif - dd if=/dev/zero of=$(BUILD_DIR)/kolibri.img count=2880 bs=512 2>&1 - mformat -f 1440 -i $(BUILD_DIR)/kolibri.img :: - dd if=$(BUILD_DIR)/boot_fat12.bin of=$(BUILD_DIR)/kolibri.img count=1 bs=512 conv=notrunc 2>&1 - mmd -i $(BUILD_DIR)/kolibri.img ::3D - mmd -i $(BUILD_DIR)/kolibri.img ::DEMOS - mmd -i $(BUILD_DIR)/kolibri.img ::DEVELOP - mmd -i $(BUILD_DIR)/kolibri.img ::DEVELOP/INFO - mmd -i $(BUILD_DIR)/kolibri.img ::DRIVERS - mmd -i $(BUILD_DIR)/kolibri.img ::File\ Managers - mmd -i $(BUILD_DIR)/kolibri.img ::FONTS - mmd -i $(BUILD_DIR)/kolibri.img ::GAMES - mmd -i $(BUILD_DIR)/kolibri.img ::LIB - mmd -i $(BUILD_DIR)/kolibri.img ::MEDIA - mmd -i $(BUILD_DIR)/kolibri.img ::MEDIA/ImgF - mmd -i $(BUILD_DIR)/kolibri.img ::NETWORK - mmd -i $(BUILD_DIR)/kolibri.img ::SETTINGS - $(mcopy_all_items) - -# The second goal: LiveCD image. -$(BUILD_DIR)/kolibri.iso: $(BUILD_DIR)/kolibri.img $(mkisofs_extra_targets) - mkisofs -U -J -pad -b kolibri.img -c boot.catalog -hide-joliet boot.catalog -graft-points \ - -A "KolibriOS AutoBuilder" -p "CleverMouse" -publisher "KolibriOS Team" -V "KolibriOS r$(REV)" -sysid "KOLIBRI" \ - -iso-level 3 -o $(BUILD_DIR)/kolibri.iso $(BUILD_DIR)/kolibri.img $(call respace,$(MKISOFS_EXTRA)) 2>&1 - -# The third goal: distribution list. -$(BUILD_DIR)/distr.lst: $(BUILD_DIR)/kolibri.img $(distribution_extra_targets) - rm -rf distribution_kit - $(call respace,$(make_distribution_dirs)) - ln -sr $(BUILD_DIR)/kolibri.img distribution_kit/kolibri.img - $(call respace,$(make_distribution_links)) - touch $(BUILD_DIR)/distr.lst - -# Special targets to modify behaviour of make. -.DELETE_ON_ERROR: -.SUFFIXES: # disable all predefined rules - -# The floppy bootsector. -$(BUILD_DIR)/boot_fat12.bin: $(KERNEL)/bootloader/boot_fat12.asm $(KERNEL)/bootloader/floppy1440.inc - fasm $(KERNEL)/bootloader/boot_fat12.asm $(BUILD_DIR)/boot_fat12.bin - -$(BUILD_DIR)/.dir 3d/.dir demos/.dir develop/.dir develop/info/.dir drivers/.dir fonts/.dir \ - games/.dir lib/.dir media/.dir network/.dir settings/.dir allskins/.dir distr_data/.dir .deps/.dir: - mkdir -p $(dir $@) - touch $@ -develop/info/.dir: develop/.dir -File\ Managers/.dir: - mkdir -p "File Managers" - touch "File Managers/.dir" - -# extra dependency for mtldr_install.exe -distr_data/mtldr_install.exe: mtldr_for_installer - -# FASM black magic goes to Makefile.fasm. -include ../common/Makefile.fasm - -# Similar for NASM. -include ../common/Makefile.nasm - -# Similar for copying files. -include ../common/Makefile.copy - -ifeq ($(BUILD_TYPE),rus) -# Special rules for copying sysfuncr.txt and fasm.txt - they aren't directly included in the image. -docpack: $(DOCDIR)SYSFUNCR.TXT $(DOCDIR)FASM.TXT -$(DOCDIR)SYSFUNCR.TXT: $(KERNEL)/docs/sysfuncr.txt - iconv -f utf-8 -t cp866 $(KERNEL)/docs/sysfuncr.txt > $(DOCDIR)SYSFUNCR.TXT -else -# Special rules for copying sysfuncs.txt and fasm.txt - they aren't directly included in the image. -docpack: $(DOCDIR)SYSFUNCS.TXT $(DOCDIR)FASM.TXT -$(DOCDIR)SYSFUNCS.TXT: $(KERNEL)/docs/sysfuncs.txt - cp $(KERNEL)/docs/sysfuncs.txt $(DOCDIR)SYSFUNCS.TXT -endif -$(DOCDIR)FASM.TXT: $(PROGS)/develop/fasm/trunk/fasm.txt - cp $(PROGS)/develop/fasm/trunk/fasm.txt $(DOCDIR)FASM.TXT - -# Similar for C--. -include ../common/Makefile.cmm - -ifeq ($(BUILD_TYPE),rus) -# Recode some text files from native encoding aka cp866 to cp1251 -define recode_meta_rule -$(1): $(2) - iconv -f cp866 -t cp1251 "$$<" > "$$@" -endef -$(foreach f, $(RECODE_TEXT_FILES), $(eval $(call recode_meta_rule,$(fbinary),$(fimage)))) -endif - -# Sorry, even black magic seems to be insufficient for -# auto-handling all subtle effects. So we just define -# command lines for compiling and linking, and -# maintain the list of sources and objects by hand. -include ../common/Makefile.msvc - -# Rules for table -table: .obj.table/table.exe - $(msvc_final) -TABLE_OBJECTS:=.obj.table/calc.obj .obj.table/func.obj .obj.table/hello.obj \ - .obj.table/KosFile.obj .obj.table/kosSyst.obj .obj.table/math2.obj \ - .obj.table/mcsmemm.obj .obj.table/parser.obj -TABLE_H_FILES:=$(wildcard $(PROGS)/other/table/*.h) -.obj.table/table.exe: $(TABLE_OBJECTS) - $(msvc_link) -$(TABLE_OBJECTS): .obj.table/%.obj: $(PROGS)/other/table/%.cpp $(TABLE_H_FILES) ../common/Makefile.msvc | .obj.table - $(msvc_compile) -.obj.table: - mkdir -p .obj.table - -# Rules for graph -graph: .obj.graph/graph.exe - $(msvc_final) -GRAPH_CPP_OBJECTS:=.obj.graph/func.obj .obj.graph/hello.obj .obj.graph/kolibri.obj \ - .obj.graph/KosFile.obj .obj.graph/kosSyst.obj .obj.graph/math2.obj \ - .obj.graph/mcsmemm.obj .obj.graph/parser.obj -GRAPH_C_OBJECTS:=.obj.graph/string.obj -GRAPH_H_FILES:=$(wildcard $(PROGS)/other/graph/*.h) -GRAPH_FASM_OBJECTS:=.obj.graph/memcpy.obj .obj.graph/memset.obj -.obj.graph/graph.exe: $(GRAPH_CPP_OBJECTS) $(GRAPH_C_OBJECTS) $(GRAPH_FASM_OBJECTS) - $(msvc_link) -$(GRAPH_CPP_OBJECTS): .obj.graph/%.obj: $(PROGS)/other/graph/%.cpp $(GRAPH_H_FILES) ../common/Makefile.msvc | .obj.graph - $(msvc_compile) -$(GRAPH_C_OBJECTS): .obj.graph/%.obj: $(PROGS)/other/graph/%.c $(GRAPH_H_FILES) ../common/Makefile.msvc | .obj.graph - $(msvc_compile) -$(GRAPH_FASM_OBJECTS): .obj.graph/%.obj: $(PROGS)/other/graph/%.asm ../common/Makefile.msvc | .obj.graph - fasm $< $@ -.obj.graph: - mkdir -p .obj.graph - -# Rules for kosilka -games/kosilka: .obj.kosilka/kosilka.exe - $(msvc_final) -KOSILKA_OBJECTS:=.obj.kosilka/kosilka.obj .obj.kosilka/KosFile.obj .obj.kosilka/kosSyst.obj .obj.kosilka/mcsmemm.obj -KOSILKA_H_FILES:=$(PROGS)/games/kosilka/*.h -.obj.kosilka/kosilka.exe: $(KOSILKA_OBJECTS) - $(msvc_link) -$(KOSILKA_OBJECTS): .obj.kosilka/%.obj: $(PROGS)/games/kosilka/%.cpp $(KOSILKA_H_FILES) ../common/Makefile.msvc | .obj.kosilka - $(msvc_compile) -.obj.kosilka: - mkdir -p .obj.kosilka - -include ../common/Makefile.gcc - -# Rules for shell -shell: .obj.shell/start.o .obj.shell/shell.o .obj.shell/kolibri.o .obj.shell/stdlib.o .obj.shell/string.o .obj.shell/ctype.o \ - $(PROGS)/system/shell/kolibri.ld - $(call gcc_link,$(PROGS)/system/shell/kolibri.ld) -.obj.shell/shell.o: $(PROGS)/system/shell/shell.c \ - $(PROGS)/system/shell/all.h \ - $(PROGS)/system/shell/system/*.h \ - $(PROGS)/system/shell/cmd/*.c \ - $(PROGS)/system/shell/modules/*.c \ - $(PROGS)/system/shell/locale/rus/globals.h \ - ../common/Makefile.gcc | .obj.shell - $(gcc_compile) -.obj.shell/kolibri.o .obj.shell/stdlib.o .obj.shell/string.o .obj.shell/ctype.o: .obj.shell/%.o: \ - $(PROGS)/system/shell/system/%.c $(PROGS)/system/shell/system/*.h \ - ../common/Makefile.gcc | .obj.shell - $(gcc_compile) -.obj.shell/start.o: $(PROGS)/system/shell/start.asm | .obj.shell - fasm $< $@ -.obj.shell: - mkdir -p .obj.shell - -# Rules for e80 -E80DIR=$(PROGS)/emulator/e80/trunk -e80: .obj.e80/start.o .obj.e80/kolibri.o .obj.e80/stdlib.o .obj.e80/string.o .obj.e80/z80.o .obj.e80/e80.o - $(call gcc_link,$(E80DIR)/kolibri.ld) -.obj.e80/e80.o: $(E80DIR)/e80.c $(E80DIR)/48.h \ - $(E80DIR)/system/*.h $(E80DIR)/system/msgbox.c \ - $(E80DIR)/z80/z80.h ../common/Makefile.gcc | .obj.e80 - $(gcc_compile) -.obj.e80/kolibri.o .obj.e80/stdlib.o .obj.e80/string.o: .obj.e80/%.o: \ - $(E80DIR)/system/%.c $(E80DIR)/system/*.h ../common/Makefile.gcc | .obj.e80 - $(gcc_compile) -.obj.e80/z80.o: $(E80DIR)/z80/z80.c $(E80DIR)/z80/* - $(gcc_compile) -.obj.e80/start.o: $(E80DIR)/asm_code.asm | .obj.e80 - fasm $< $@ -.obj.e80: - mkdir -p .obj.e80 - -# Rules for sdk/sound, used by media/ac97snd -SOUNDDIR=$(PROGS)/develop/sdk/trunk/sound/src -SOUND_OBJECTS:=$(patsubst $(SOUNDDIR)/%.asm,.sdk/%.obj,$(wildcard $(SOUNDDIR)/*.asm)) -SOUND_INC_FILES:=$(wildcard $(SOUNDDIR)/*.inc) -.sdk/sound.lib: $(SOUND_OBJECTS) - win32-link /lib /out:$@ $^ -$(SOUND_OBJECTS): .sdk/%.obj: $(SOUNDDIR)/%.asm $(SOUND_INC_FILES) | .sdk - fasm $< $@ -.sdk: - mkdir -p .sdk -# Rules for media/ac97snd -AC97DIR=$(PROGS)/media/ac97snd -media/ac97snd: .obj.ac97snd/ac97snd.exe - $(msvc_final) -.obj.ac97snd/ac97snd.exe: .obj.ac97snd/ac97wav.obj .obj.ac97snd/crt.obj .obj.ac97snd/k_lib.obj \ - .obj.ac97snd/mpg.lib .sdk/sound.lib .obj.ac97snd/ufmod.obj - $(msvc_link) -.obj.ac97snd/ac97wav.obj: $(AC97DIR)/ac97snd/ac97wav.c \ - $(AC97DIR)/kolibri.h $(AC97DIR)/ac97snd/ac97wav.h $(AC97DIR)/mpg/mpg123.h \ - $(AC97DIR)/sound.h $(AC97DIR)/ufmod-codec.h ../common/Makefile.msvc | .obj.ac97snd - $(msvc_compile) -.obj.ac97snd/crt.obj: $(AC97DIR)/ac97snd/crt.c $(AC97DIR)/ac97snd/crt.h ../common/Makefile.msvc | .obj.ac97snd - $(msvc_compile) -.obj.ac97snd/k_lib.obj: $(AC97DIR)/ac97snd/k_lib.asm $(AC97DIR)/ac97snd/proc32.inc | .obj.ac97snd - fasm $< $@ -.obj.ac97snd/ufmod.obj: $(AC97DIR)/ufmod-config.asm | .obj.ac97snd - fasm $< $@ -s .deps/ac97snd-ufmod.fas - prepsrc .deps/ac97snd-ufmod.fas /dev/stdout | \ - perl -n -e 's|\\|/|g;s| |\\ |g;push @a,$$1 if/^;include\\ \x27(.*?)\x27/;' \ - -e 'END{$$a=join " \\\n ",@a;print "$@: $$a\n$$a:\n"}' > .deps/ac97snd-ufmod.Po --include .deps/ac97snd-ufmod.Po -AC97SND_MPG_C_FILES:=$(wildcard $(AC97DIR)/mpg/*.c) -AC97SND_MPG_H_FILES:=$(wildcard $(AC97DIR)/mpg/*.h) -AC97SND_MPG_C_OBJECTS:=$(patsubst $(AC97DIR)/mpg/%.c,.obj.ac97snd/%.o,$(AC97SND_MPG_C_FILES)) -.obj.ac97snd/mpg.lib: $(AC97SND_MPG_C_OBJECTS) .obj.ac97snd/pow.obj - win32-link /lib /ltcg /out:$@ $^ -$(AC97SND_MPG_C_OBJECTS): .obj.ac97snd/%.o: $(AC97DIR)/mpg/%.c $(AC97SND_MPG_H_FILES) ../common/Makefile.msvc | .obj.ac97snd - $(msvc_compile) -.obj.ac97snd/pow.obj: $(AC97DIR)/mpg/pow.asm $(AC97DIR)/mpg/proc32.inc | .obj.ac97snd - fasm $< $@ -.obj.ac97snd: - mkdir -p .obj.ac97snd - -# Rules for atikms.dll -# Use Makefile from $(REPOSITORY)/drivers/ddk and $(REPOSITORY)/drivers/video/drm/radeon -# However, dependencies must be duplicated - I don't know how to avoid this -# without need to rebuild kolibri.img at every iteration... -# Note that we are going to write in the directory shared -# between all Makefiles, so we need locked operations. -drivers/atikms.dll: $(REPOSITORY)/drivers/video/drm/radeon/atikms.dll drivers/.dir - kpack --nologo $< $@ -$(REPOSITORY)/drivers/video/drm/radeon/atikms.dll: $(REPOSITORY)/drivers/video/drm/radeon/Makefile.lto - flock $(REPOSITORY)/drivers/video/drm/radeon/.lock \ - $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/video/drm/radeon -f Makefile.lto -$(REPOSITORY)/drivers/ddk/libddk.a: $(REPOSITORY)/drivers/ddk/Makefile - flock $(REPOSITORY)/drivers/ddk/.lock \ - $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/ddk libddk.a -$(REPOSITORY)/drivers/ddk/libcore.a: $(REPOSITORY)/drivers/ddk/Makefile - flock $(REPOSITORY)/drivers/ddk/.lock \ - $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/ddk libcore.a -# dependencies -$(REPOSITORY)/drivers/video/drm/radeon/atikms.dll: \ - $(REPOSITORY)/drivers/video/drm/radeon/atikms.lds \ - $(REPOSITORY)/drivers/ddk/libddk.a \ - $(REPOSITORY)/drivers/ddk/libcore.a \ - $(REPOSITORY)/drivers/video/drm/radeon/*.[Sch] \ - $(REPOSITORY)/drivers/video/drm/radeon/*.asm \ - $(REPOSITORY)/drivers/video/drm/radeon/Makefile \ - $(REPOSITORY)/drivers/video/drm/radeon/firmware/*.bin \ - $(REPOSITORY)/drivers/include/*.h \ - $(REPOSITORY)/drivers/include/*/*.h \ - $(REPOSITORY)/drivers/include/*/*/*.h \ - $(REPOSITORY)/drivers/include/*/*/*/*.h -$(REPOSITORY)/drivers/ddk/libddk.a: \ - $(REPOSITORY)/drivers/ddk/*/* \ - $(REPOSITORY)/drivers/include/*.h \ - $(REPOSITORY)/drivers/include/*/*.h \ - $(REPOSITORY)/drivers/include/*/*/*.h \ - $(REPOSITORY)/drivers/include/*/*/*/*.h -$(REPOSITORY)/drivers/ddk/libcore.a: \ - $(REPOSITORY)/drivers/ddk/core.S diff --git a/data/common/Makefile.msvc b/data/common/Makefile.msvc deleted file mode 100644 index 0902ceed22..0000000000 --- a/data/common/Makefile.msvc +++ /dev/null @@ -1,13 +0,0 @@ -define msvc_compile -win32-cl /c /O2 /Os /Oy /GF /GS- /GR- /EHs-c- /fp:fast /GL /QIfist /Gr /DAUTOBUILD /Fo$@ Z:$< >&2 -endef -define msvc_link -win32-link /section:.bss,E /fixed:no /subsystem:native \ -/merge:.data=.text /merge:.rdata=.text /merge:.1seg=.text \ -/entry:crtStartUp /out:$@ /ltcg /nodefaultlib \ -$(addprefix Z:,$^) >&2 -endef -define msvc_final -EXENAME=$< fasm doexe2.asm "$@" -kpack --nologo "$@" -endef diff --git a/data/common/Makefile.nasm b/data/common/Makefile.nasm deleted file mode 100644 index 1d2c226492..0000000000 --- a/data/common/Makefile.nasm +++ /dev/null @@ -1,16 +0,0 @@ -# This is similar to Makefile.fasm, look there for comments. -define nasm_meta_rule -.deps/$(4).Po: $(2) ../common/Makefile.nasm .deps/.dir - nasm -I$$(dir $(2)) -o "$(1)" -M $$< > .deps/$(4).Tpo 2>/dev/null; \ - if [ $$$$? -eq 0 ]; then perl -ln -e 'next unless $$$$_;' \ - -e 'm/((.*): )?(.*)/;$$$$a=$$$$2 if $$$$2;push @b,$$$$3;' \ - -e 'END{$$$$b=join "\n",@b;print "$$$$a .deps/$(4).Po: $$$$b\n$$$$b:"}' \ - .deps/$(4).Tpo > .deps/$(4).Po; fi - rm -f .deps/$(4).Tpo -$(1): $(2) ../common/Makefile.nasm $$(call respace,$$(addsuffix .dir,$(3))) - nasm -I$$(dir $(2)) -o "$$@" $$< - kpack --nologo "$$@" --include .deps/$(4).Po -endef - -$(foreach f,$(NASM_PROGRAMS),$(eval $(call nasm_meta_rule,$(fbinary),$(fsource),$(binarydir),$(progname)))) diff --git a/data/common/Makefile.pestrip b/data/common/Makefile.pestrip deleted file mode 100644 index 096bc90356..0000000000 --- a/data/common/Makefile.pestrip +++ /dev/null @@ -1,11 +0,0 @@ -# This is not a independent Makefile; it is auxiliary file -# included from main Makefile. - -# The arguments of macro pestrip_meta_rule: -# $(1) = name of stripped file, -# $(2) = name of input file -define pestrip_meta_rule -$(1): $(2) ../common/Makefile.pestrip ../common/pestrip.asm - EXENAME="$$<" fasm ../common/pestrip.asm "$$@" - kpack --nologo "$$@" -endef diff --git a/data/eng/Makefile b/data/eng/Makefile deleted file mode 100644 index 05d11202db..0000000000 --- a/data/eng/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -BUILD_TYPE=eng -include ../common/Makefile.main diff --git a/data/eng/lang.inc b/data/eng/lang.inc deleted file mode 100644 index dc151ef654..0000000000 --- a/data/eng/lang.inc +++ /dev/null @@ -1 +0,0 @@ -lang fix en \ No newline at end of file diff --git a/data/eng/lang_nasm.inc b/data/eng/lang_nasm.inc deleted file mode 100644 index dbfde88817..0000000000 --- a/data/eng/lang_nasm.inc +++ /dev/null @@ -1 +0,0 @@ -%define lang 'en' diff --git a/data/eng/tup.config b/data/eng/tup.config new file mode 100644 index 0000000000..92f5bf5672 --- /dev/null +++ b/data/eng/tup.config @@ -0,0 +1 @@ +CONFIG_LANG=en diff --git a/data/et/Makefile b/data/et/Makefile deleted file mode 100644 index 1de535559f..0000000000 --- a/data/et/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -BUILD_TYPE=et -include ../common/Makefile.main diff --git a/data/et/lang.inc b/data/et/lang.inc deleted file mode 100644 index a1920a1e4b..0000000000 --- a/data/et/lang.inc +++ /dev/null @@ -1 +0,0 @@ -lang fix et \ No newline at end of file diff --git a/data/et/lang_nasm.inc b/data/et/lang_nasm.inc deleted file mode 100644 index f22b2c4844..0000000000 --- a/data/et/lang_nasm.inc +++ /dev/null @@ -1 +0,0 @@ -%define lang 'et' diff --git a/data/et/tup.config b/data/et/tup.config new file mode 100644 index 0000000000..815f189f3e --- /dev/null +++ b/data/et/tup.config @@ -0,0 +1 @@ +CONFIG_LANG=et diff --git a/data/generate_makefile_skins.sh b/data/generate_makefile_skins.sh deleted file mode 100644 index 3851df0264..0000000000 --- a/data/generate_makefile_skins.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -echo SKIN_SOURCES:=\\ -while read skinname -do - skinpath=../../skins/_old/"$skinname" - for f in $skinpath/*.{asm,ASM} - do - if [ ! -f "$f" ]; then continue; fi - if expr "$f" : '.*\.dtp' > /dev/null; then continue; fi - echo -n allskins/$skinname.skn | sed 's/ /|/g' - echo -n ':Skins/:' - echo -n $f | sed 's/ /|/g' - echo " \\" - done - for f in ../../skins/_old/"$skinname"/*/*.{asm,ASM} - do - if [ ! -f "$f" ]; then continue; fi - if expr "$f" : '.*\.dtp' > /dev/null; then continue; fi - g=`basename "$(dirname "$f")"` - echo -n allskins/$g.skn | sed 's/ /|/g' - echo -n ':Skins/:' - echo -n $f | sed 's/ /|/g' - echo " \\" - done -done -echo '# end of list' diff --git a/data/it/Makefile b/data/it/Makefile deleted file mode 100644 index 2fdb333df0..0000000000 --- a/data/it/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -BUILD_TYPE=it -include ../common/Makefile.main diff --git a/data/it/lang.inc b/data/it/lang.inc deleted file mode 100644 index c5c0cd85d9..0000000000 --- a/data/it/lang.inc +++ /dev/null @@ -1 +0,0 @@ -lang fix it \ No newline at end of file diff --git a/data/it/lang_nasm.inc b/data/it/lang_nasm.inc deleted file mode 100644 index a229bc9eef..0000000000 --- a/data/it/lang_nasm.inc +++ /dev/null @@ -1 +0,0 @@ -%define lang 'it' diff --git a/data/it/tup.config b/data/it/tup.config new file mode 100644 index 0000000000..33889c07d8 --- /dev/null +++ b/data/it/tup.config @@ -0,0 +1 @@ +CONFIG_LANG=it diff --git a/data/rus/Makefile b/data/rus/Makefile deleted file mode 100644 index faff7d5ec9..0000000000 --- a/data/rus/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -BUILD_TYPE=rus -include ../common/Makefile.main diff --git a/data/rus/lang.inc b/data/rus/lang.inc deleted file mode 100644 index 30c0149bd9..0000000000 --- a/data/rus/lang.inc +++ /dev/null @@ -1 +0,0 @@ -lang fix ru \ No newline at end of file diff --git a/data/rus/lang_nasm.inc b/data/rus/lang_nasm.inc deleted file mode 100644 index b0ad4180f8..0000000000 --- a/data/rus/lang_nasm.inc +++ /dev/null @@ -1 +0,0 @@ -%define lang 'ru' diff --git a/data/rus/tup.config b/data/rus/tup.config new file mode 100644 index 0000000000..9dd0becc97 --- /dev/null +++ b/data/rus/tup.config @@ -0,0 +1 @@ +CONFIG_LANG=ru diff --git a/data/sp/Makefile b/data/sp/Makefile deleted file mode 100644 index f547a93314..0000000000 --- a/data/sp/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -BUILD_TYPE=sp -include ../common/Makefile.main diff --git a/data/sp/lang.inc b/data/sp/lang.inc deleted file mode 100644 index 48c8fe6af1..0000000000 --- a/data/sp/lang.inc +++ /dev/null @@ -1 +0,0 @@ -lang fix sp diff --git a/data/sp/lang_nasm.inc b/data/sp/lang_nasm.inc deleted file mode 100644 index 2ddd45d33e..0000000000 --- a/data/sp/lang_nasm.inc +++ /dev/null @@ -1 +0,0 @@ -%define lang 'sp' diff --git a/data/sp/tup.config b/data/sp/tup.config new file mode 100644 index 0000000000..d4ffe7ba30 --- /dev/null +++ b/data/sp/tup.config @@ -0,0 +1 @@ +CONFIG_LANG=sp diff --git a/drivers/Tupfile.lua b/drivers/Tupfile.lua new file mode 100644 index 0000000000..54e17dc5cd --- /dev/null +++ b/drivers/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +ROOT = ".." +tup.rule("sceletone.asm", "fasm %f %o " .. tup.getconfig("PESTRIP_CMD") .. tup.getconfig("KPACK_CMD"), "%B.sys") diff --git a/drivers/audio/Tupfile.lua b/drivers/audio/Tupfile.lua new file mode 100644 index 0000000000..1c40d56f5c --- /dev/null +++ b/drivers/audio/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +ROOT = "../.." +tup.foreach_rule("*.asm", "fasm %f %o " .. tup.getconfig("PESTRIP_CMD") .. tup.getconfig("KPACK_CMD"), "%B.sys") diff --git a/drivers/audio/infinity/Tupfile.lua b/drivers/audio/infinity/Tupfile.lua new file mode 100644 index 0000000000..a685816bd2 --- /dev/null +++ b/drivers/audio/infinity/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +ROOT = "../../.." +tup.rule("infinity.asm", "fasm %f %o " .. tup.getconfig("PESTRIP_CMD") .. tup.getconfig("KPACK_CMD"), "%B.sys") diff --git a/drivers/audio/intel_hda/Tupfile.lua b/drivers/audio/intel_hda/Tupfile.lua new file mode 100644 index 0000000000..d69a7d625f --- /dev/null +++ b/drivers/audio/intel_hda/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +ROOT = "../../.." +tup.rule("intel_hda.asm", "fasm %f %o " .. tup.getconfig("PESTRIP_CMD") .. tup.getconfig("KPACK_CMD"), "%B.sys") diff --git a/drivers/audio/sb16/Tupfile.lua b/drivers/audio/sb16/Tupfile.lua new file mode 100644 index 0000000000..f6e36012b8 --- /dev/null +++ b/drivers/audio/sb16/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +ROOT = "../../.." +tup.rule("sb16.asm", "fasm %f %o " .. tup.getconfig("PESTRIP_CMD") .. tup.getconfig("KPACK_CMD"), "%B.sys") diff --git a/drivers/disk/Tupfile.lua b/drivers/disk/Tupfile.lua new file mode 100644 index 0000000000..f52813abb7 --- /dev/null +++ b/drivers/disk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +ROOT = "../.." +tup.rule("tmpdisk.asm", "fasm %f %o " .. tup.getconfig("PESTRIP_CMD") .. tup.getconfig("KPACK_CMD"), "%B.sys") diff --git a/drivers/ethernet/Tupfile.lua b/drivers/ethernet/Tupfile.lua new file mode 100644 index 0000000000..1c40d56f5c --- /dev/null +++ b/drivers/ethernet/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +ROOT = "../.." +tup.foreach_rule("*.asm", "fasm %f %o " .. tup.getconfig("PESTRIP_CMD") .. tup.getconfig("KPACK_CMD"), "%B.sys") diff --git a/drivers/mouse/Tupfile.lua b/drivers/mouse/Tupfile.lua new file mode 100644 index 0000000000..79f8753dde --- /dev/null +++ b/drivers/mouse/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +ROOT = "../.." +tup.rule("commouse.asm", "fasm %f %o " .. tup.getconfig("PESTRIP_CMD") .. tup.getconfig("KPACK_CMD"), "%B.sys") diff --git a/drivers/mouse/ps2mouse4d/trunk/Tupfile.lua b/drivers/mouse/ps2mouse4d/trunk/Tupfile.lua new file mode 100644 index 0000000000..783ef5c0f8 --- /dev/null +++ b/drivers/mouse/ps2mouse4d/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +ROOT = "../../../.." +tup.rule("ps2mouse.asm", "fasm %f %o " .. tup.getconfig("PESTRIP_CMD") .. tup.getconfig("KPACK_CMD"), "%B.sys") diff --git a/drivers/usb/Tupfile.lua b/drivers/usb/Tupfile.lua new file mode 100644 index 0000000000..1c40d56f5c --- /dev/null +++ b/drivers/usb/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +ROOT = "../.." +tup.foreach_rule("*.asm", "fasm %f %o " .. tup.getconfig("PESTRIP_CMD") .. tup.getconfig("KPACK_CMD"), "%B.sys") diff --git a/drivers/usb/usbftdi/Tupfile.lua b/drivers/usb/usbftdi/Tupfile.lua new file mode 100644 index 0000000000..5801ab513b --- /dev/null +++ b/drivers/usb/usbftdi/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +ROOT = "../../.." +tup.rule("usbftdi.asm", "fasm %f %o " .. tup.getconfig("PESTRIP_CMD") .. tup.getconfig("KPACK_CMD"), "%B.sys") diff --git a/drivers/usb/usbhid/Tupfile.lua b/drivers/usb/usbhid/Tupfile.lua new file mode 100644 index 0000000000..bb6b502cb7 --- /dev/null +++ b/drivers/usb/usbhid/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +ROOT = "../../.." +tup.rule("usbhid.asm", "fasm %f %o " .. tup.getconfig("PESTRIP_CMD") .. tup.getconfig("KPACK_CMD"), "%B.sys") diff --git a/drivers/video/Tupfile.lua b/drivers/video/Tupfile.lua new file mode 100644 index 0000000000..1c40d56f5c --- /dev/null +++ b/drivers/video/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +ROOT = "../.." +tup.foreach_rule("*.asm", "fasm %f %o " .. tup.getconfig("PESTRIP_CMD") .. tup.getconfig("KPACK_CMD"), "%B.sys") diff --git a/kernel/trunk/Tupfile.lua b/kernel/trunk/Tupfile.lua new file mode 100644 index 0000000000..8997839d6f --- /dev/null +++ b/kernel/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > %o", {"lang.inc"}) +tup.rule({"kernel.asm", extra_inputs = {"lang.inc"}}, "fasm -m 65536 %f %o " .. tup.getconfig("KERPACK_CMD"), "kernel.mnt") diff --git a/kernel/trunk/bootloader/Tupfile.lua b/kernel/trunk/bootloader/Tupfile.lua new file mode 100644 index 0000000000..087b722530 --- /dev/null +++ b/kernel/trunk/bootloader/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > %o", {"lang.inc"}) +tup.rule({"boot_fat12.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o", "boot_fat12.bin") diff --git a/programs/cmm/appearance/Tupfile.lua b/programs/cmm/appearance/Tupfile.lua new file mode 100644 index 0000000000..bca006af70 --- /dev/null +++ b/programs/cmm/appearance/Tupfile.lua @@ -0,0 +1,6 @@ +if tup.getconfig("NO_CMM") ~= "" then return end +if tup.getconfig("LANG") == "ru" +then C_LANG = "LANG_RUS" +else C_LANG = "LANG_ENG" -- this includes default case without config +end +tup.rule("appearance.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "appearance.com") diff --git a/programs/cmm/browser/Tupfile.lua b/programs/cmm/browser/Tupfile.lua new file mode 100644 index 0000000000..5ab7fb5847 --- /dev/null +++ b/programs/cmm/browser/Tupfile.lua @@ -0,0 +1,6 @@ +if tup.getconfig("NO_CMM") ~= "" then return end +if tup.getconfig("LANG") == "ru" +then C_LANG = "LANG_RUS" +else C_LANG = "LANG_ENG" -- this includes default case without config +end +tup.rule("WebView.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "WebView.com") diff --git a/programs/cmm/dicty/Tupfile.lua b/programs/cmm/dicty/Tupfile.lua new file mode 100644 index 0000000000..e5caa55c17 --- /dev/null +++ b/programs/cmm/dicty/Tupfile.lua @@ -0,0 +1,6 @@ +if tup.getconfig("NO_CMM") ~= "" then return end +if tup.getconfig("LANG") == "ru" +then C_LANG = "LANG_RUS" +else C_LANG = "LANG_ENG" -- this includes default case without config +end +tup.rule("dicty.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "dicty.com") diff --git a/programs/cmm/downloader/Tupfile.lua b/programs/cmm/downloader/Tupfile.lua new file mode 100644 index 0000000000..59b07470e7 --- /dev/null +++ b/programs/cmm/downloader/Tupfile.lua @@ -0,0 +1,6 @@ +if tup.getconfig("NO_CMM") ~= "" then return end +if tup.getconfig("LANG") == "ru" +then C_LANG = "LANG_RUS" +else C_LANG = "LANG_ENG" -- this includes default case without config +end +tup.rule("Downloader.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "Downloader.com") diff --git a/programs/cmm/end/Tupfile.lua b/programs/cmm/end/Tupfile.lua new file mode 100644 index 0000000000..a0c763ccaa --- /dev/null +++ b/programs/cmm/end/Tupfile.lua @@ -0,0 +1,6 @@ +if tup.getconfig("NO_CMM") ~= "" then return end +if tup.getconfig("LANG") == "ru" +then C_LANG = "LANG_RUS" +else C_LANG = "LANG_ENG" -- this includes default case without config +end +tup.rule("end.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "end.com") diff --git a/programs/cmm/eolite/Tupfile.lua b/programs/cmm/eolite/Tupfile.lua new file mode 100644 index 0000000000..9ac1c52ca4 --- /dev/null +++ b/programs/cmm/eolite/Tupfile.lua @@ -0,0 +1,6 @@ +if tup.getconfig("NO_CMM") ~= "" then return end +if tup.getconfig("LANG") == "ru" +then C_LANG = "LANG_RUS" +else C_LANG = "LANG_ENG" -- this includes default case without config +end +tup.rule("Eolite.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "Eolite.com") diff --git a/programs/cmm/example/Tupfile.lua b/programs/cmm/example/Tupfile.lua new file mode 100644 index 0000000000..2b4e8cf7ea --- /dev/null +++ b/programs/cmm/example/Tupfile.lua @@ -0,0 +1,6 @@ +if tup.getconfig("NO_CMM") ~= "" then return end +if tup.getconfig("LANG") == "ru" +then C_LANG = "LANG_RUS" +else C_LANG = "LANG_ENG" -- this includes default case without config +end +tup.rule("example.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "example.com") diff --git a/programs/cmm/game_center/Tupfile.lua b/programs/cmm/game_center/Tupfile.lua new file mode 100644 index 0000000000..5eab01e8bb --- /dev/null +++ b/programs/cmm/game_center/Tupfile.lua @@ -0,0 +1,6 @@ +if tup.getconfig("NO_CMM") ~= "" then return end +if tup.getconfig("LANG") == "ru" +then C_LANG = "LANG_RUS" +else C_LANG = "LANG_ENG" -- this includes default case without config +end +tup.rule("game_center.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "game_center.com") diff --git a/programs/cmm/installer/Tupfile.lua b/programs/cmm/installer/Tupfile.lua new file mode 100644 index 0000000000..b35c46f13b --- /dev/null +++ b/programs/cmm/installer/Tupfile.lua @@ -0,0 +1,6 @@ +if tup.getconfig("NO_CMM") ~= "" then return end +if tup.getconfig("LANG") == "ru" +then C_LANG = "LANG_RUS" +else C_LANG = "LANG_ENG" -- this includes default case without config +end +tup.rule("installer.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "installer.com") diff --git a/programs/cmm/kolibrin/Tupfile.lua b/programs/cmm/kolibrin/Tupfile.lua new file mode 100644 index 0000000000..181ce9be76 --- /dev/null +++ b/programs/cmm/kolibrin/Tupfile.lua @@ -0,0 +1,6 @@ +if tup.getconfig("NO_CMM") ~= "" then return end +if tup.getconfig("LANG") == "ru" +then C_LANG = "LANG_RUS" +else C_LANG = "LANG_ENG" -- this includes default case without config +end +tup.rule("kolibrin.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "kolibrin.com") diff --git a/programs/cmm/liza/Tupfile.lua b/programs/cmm/liza/Tupfile.lua new file mode 100644 index 0000000000..53ef173007 --- /dev/null +++ b/programs/cmm/liza/Tupfile.lua @@ -0,0 +1,6 @@ +if tup.getconfig("NO_CMM") ~= "" then return end +if tup.getconfig("LANG") == "ru" +then C_LANG = "LANG_RUS" +else C_LANG = "LANG_ENG" -- this includes default case without config +end +tup.rule("liza.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "liza.com") diff --git a/programs/cmm/notify/Tupfile.lua b/programs/cmm/notify/Tupfile.lua new file mode 100644 index 0000000000..a270be479f --- /dev/null +++ b/programs/cmm/notify/Tupfile.lua @@ -0,0 +1,6 @@ +if tup.getconfig("NO_CMM") ~= "" then return end +if tup.getconfig("LANG") == "ru" +then C_LANG = "LANG_RUS" +else C_LANG = "LANG_ENG" -- this includes default case without config +end +tup.rule("notify.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "notify.com") diff --git a/programs/cmm/tmpdisk/Tupfile.lua b/programs/cmm/tmpdisk/Tupfile.lua new file mode 100644 index 0000000000..682cb57f84 --- /dev/null +++ b/programs/cmm/tmpdisk/Tupfile.lua @@ -0,0 +1,6 @@ +if tup.getconfig("NO_CMM") ~= "" then return end +if tup.getconfig("LANG") == "ru" +then C_LANG = "LANG_RUS" +else C_LANG = "LANG_ENG" -- this includes default case without config +end +tup.rule("tmpdisk.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "tmpdisk.com") diff --git a/programs/demos/3DS/Tupfile.lua b/programs/demos/3DS/Tupfile.lua new file mode 100644 index 0000000000..1d71eb4e60 --- /dev/null +++ b/programs/demos/3DS/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("VIEW3DS.ASM", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "VIEW3DS") diff --git a/programs/demos/3dcube2/trunk/Tupfile.lua b/programs/demos/3dcube2/trunk/Tupfile.lua new file mode 100644 index 0000000000..0809f54f78 --- /dev/null +++ b/programs/demos/3dcube2/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"3DCUBE2.ASM", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "3DCUBE2") diff --git a/programs/demos/3detx60b/trunk/3DETX60B.ASM b/programs/demos/3detx60b/trunk/3DETX60B.ASM index d138f74cd9..4b0f680462 100644 --- a/programs/demos/3detx60b/trunk/3DETX60B.ASM +++ b/programs/demos/3detx60b/trunk/3DETX60B.ASM @@ -2480,18 +2480,18 @@ labellen: ;Texture pusck 32*32 256 texpack_gif: -file 'TEXPACK.gif' +file 'texpack.gif' rb 50 ;Ground texture bmp_texmap: -file 'TEXMAP.bmp' +file 'texmap.bmp' rb 50 ; Ground livel map gif_file_area5: -file 'MAP.gif' ;level map +file 'map.gif' ;level map rb 50 rb 8 diff --git a/programs/demos/3detx60b/trunk/Tupfile.lua b/programs/demos/3detx60b/trunk/Tupfile.lua new file mode 100644 index 0000000000..76d76543a1 --- /dev/null +++ b/programs/demos/3detx60b/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"3DETX60B.ASM", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "3DETX60B") diff --git a/programs/demos/3dsheart/trunk/Tupfile.lua b/programs/demos/3dsheart/trunk/Tupfile.lua new file mode 100644 index 0000000000..28793a6555 --- /dev/null +++ b/programs/demos/3dsheart/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("3dsheart.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "3dsheart") diff --git a/programs/demos/3dspiral/trunk/Tupfile.lua b/programs/demos/3dspiral/trunk/Tupfile.lua new file mode 100644 index 0000000000..311f4bbe6f --- /dev/null +++ b/programs/demos/3dspiral/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("3dspiral.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "3dspiral") diff --git a/programs/demos/3dtcub10/trunk/Tupfile.lua b/programs/demos/3dtcub10/trunk/Tupfile.lua new file mode 100644 index 0000000000..42f82c18a2 --- /dev/null +++ b/programs/demos/3dtcub10/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"3DTCUB10.ASM", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "3DTCUB10") diff --git a/programs/demos/3dwav/trunk/Tupfile.lua b/programs/demos/3dwav/trunk/Tupfile.lua new file mode 100644 index 0000000000..f347f94651 --- /dev/null +++ b/programs/demos/3dwav/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("3dwav.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "3dwav") diff --git a/programs/demos/aclock/trunk/Tupfile.lua b/programs/demos/aclock/trunk/Tupfile.lua new file mode 100644 index 0000000000..a5f3786eb7 --- /dev/null +++ b/programs/demos/aclock/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_NASM") ~= "" then return end +tup.rule("aclock.asm", "nasm -f bin -o %o %f " .. tup.getconfig("KPACK_CMD"), "aclock") diff --git a/programs/demos/aclock/trunk/aclock.asm b/programs/demos/aclock/trunk/aclock.asm index 09d8709af5..96cf229102 100644 --- a/programs/demos/aclock/trunk/aclock.asm +++ b/programs/demos/aclock/trunk/aclock.asm @@ -201,7 +201,7 @@ image_end: ;******************************************************************** ; uninitialized data ;******************************************************************** - section .bss + section .bss align=4 wndColors resb MOS_WNDCOLORS_size procInfo resb MOS_PROCESSINFO_size diff --git a/programs/demos/bcdclk/trunk/Tupfile.lua b/programs/demos/bcdclk/trunk/Tupfile.lua new file mode 100644 index 0000000000..99f712846e --- /dev/null +++ b/programs/demos/bcdclk/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"bcdclk.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "bcdclk") diff --git a/programs/demos/bgitest/trunk/Tupfile.lua b/programs/demos/bgitest/trunk/Tupfile.lua new file mode 100644 index 0000000000..9706c4878d --- /dev/null +++ b/programs/demos/bgitest/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"bgitest.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "bgitest") diff --git a/programs/demos/buddhabrot/trunk/Tupfile.lua b/programs/demos/buddhabrot/trunk/Tupfile.lua new file mode 100644 index 0000000000..3199f69203 --- /dev/null +++ b/programs/demos/buddhabrot/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("buddhabrot.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "buddhabrot") diff --git a/programs/demos/colorref/trunk/Tupfile.lua b/programs/demos/colorref/trunk/Tupfile.lua new file mode 100644 index 0000000000..dc478d38dd --- /dev/null +++ b/programs/demos/colorref/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"colorref.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "colorref") diff --git a/programs/demos/crownscr/trunk/Tupfile.lua b/programs/demos/crownscr/trunk/Tupfile.lua new file mode 100644 index 0000000000..0a1efa30b0 --- /dev/null +++ b/programs/demos/crownscr/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"crownscr.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "crownscr") diff --git a/programs/demos/cslide/trunk/Tupfile.lua b/programs/demos/cslide/trunk/Tupfile.lua new file mode 100644 index 0000000000..5f0dd9fa13 --- /dev/null +++ b/programs/demos/cslide/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"cslide.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "cslide") diff --git a/programs/demos/cubeline/trunk/ProcessTab.h b/programs/demos/cubeline/trunk/ProcessTab.h index 320a6dbb5e..104e607f92 100644 --- a/programs/demos/cubeline/trunk/ProcessTab.h +++ b/programs/demos/cubeline/trunk/ProcessTab.h @@ -1,24 +1,26 @@ +#pragma pack(push, 1) struct process_table_entry_ { - __u32 cpu_usage __attribute__((packed)); - __u16 pos_in_windowing_stack __attribute__((packed)); - __u16 win_stack_val_at_ecx __attribute__((packed)); - __u16 rez1 __attribute__((packed)); - char name[11] __attribute__((packed)); - __u8 rez2 __attribute__((packed)); - __u32 memstart __attribute__((packed)); - __u32 memused __attribute__((packed)); - __u32 pid __attribute__((packed)); - __u32 winx_start,winy_start __attribute__((packed)); - __u32 winx_size,winy_size __attribute__((packed)); - __u8 slot __attribute__((packed)); - __u8 rez3 __attribute__((packed)); - __u32 clarx_start,clary_start __attribute__((packed)); - __u32 clarx_size,clary_size __attribute__((packed)); - __u8 win_condition __attribute__((packed)); - __u8 buf[955] __attribute__((packed)); -} __attribute__((packed)); + __u32 cpu_usage; + __u16 pos_in_windowing_stack; + __u16 win_stack_val_at_ecx; + __u16 rez1; + char name[11]; + __u8 rez2; + __u32 memstart; + __u32 memused; + __u32 pid; + __u32 winx_start,winy_start; + __u32 winx_size,winy_size; + __u8 slot; + __u8 rez3; + __u32 clarx_start,clary_start; + __u32 clarx_size,clary_size; + __u8 win_condition; + __u8 buf[955]; +}; +#pragma pack(pop) #define TYPEWIN(D,C,B,A,Y,RR,GG,BB) (D<<31)|(C<<30)|(B<<29)|(A<<28)|(Y<<24)|\ (RR<<16)|(GG<<8)|BB diff --git a/programs/demos/cubeline/trunk/Tupfile.lua b/programs/demos/cubeline/trunk/Tupfile.lua new file mode 100644 index 0000000000..ed7c0f993c --- /dev/null +++ b/programs/demos/cubeline/trunk/Tupfile.lua @@ -0,0 +1,7 @@ +if tup.getconfig("NO_GCC") ~= "" then return end +HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../.." or tup.getconfig("HELPERDIR") +tup.include(HELPERDIR .. "/use_gcc.lua") +tup.include(HELPERDIR .. "/use_menuetlibc.lua") +tup.include(HELPERDIR .. "/use_tinygl.lua") +compile_gcc{"main.cpp", "fps.cpp"} +link_gcc("cubeline") diff --git a/programs/demos/cubeline/trunk/main.cpp b/programs/demos/cubeline/trunk/main.cpp index f664a3c88e..4c18e744c9 100644 --- a/programs/demos/cubeline/trunk/main.cpp +++ b/programs/demos/cubeline/trunk/main.cpp @@ -16,10 +16,10 @@ iadn@bk.ru int Fps (long x, long y); extern "C"{ -void app_main(void); +int main(void); } -struct { +static struct { int x,y; int dx,dy; } win; @@ -29,19 +29,19 @@ struct { #define KEY_ESC 1 #define KEY_F 33 -char *title1 = "TinyGL in KolibriOS"; -char *title2 = "F full screen"; -char *title3 = "ESC - exit"; -char *fps = "FPS:"; +static char title1[] = "TinyGL in KolibriOS"; +static char title2[] = "F full screen"; +static char title3[] = "ESC - exit"; +static char fps[] = "FPS:"; -unsigned char FullScreen = 0; -unsigned char skin = 3; +static unsigned char FullScreen = 0; +static unsigned char skin = 3; -float angle; -process_table_entry_* pri; -KOSGLContext cgl; +static float angle; +static process_table_entry_* pri; +static KOSGLContext cgl; -void draw_cube() +static void draw_cube() { float x,y,z; glBegin(GL_LINES); @@ -130,7 +130,7 @@ void draw_cube() glEnd(); } -void DrawGL() +static void DrawGL() { glLoadIdentity(); // glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -145,7 +145,7 @@ void DrawGL() kosglSwapBuffers(); } -void reshape() +static void reshape() { __menuet__get_process_table((process_table_entry*)pri,-1); glViewport(0, 0, pri->winx_size, pri->winy_size-20); @@ -156,13 +156,13 @@ void reshape() glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); } -void disabletgl() +static void disabletgl() { kosglDestroyContext(cgl); delete pri; } -void Title() +static void Title() { __menuet__write_text(300,8,0x10ffffff,fps,strlen(fps)); __menuet__write_text(8,8,0x10ffffff,title1,strlen(title1)); @@ -170,7 +170,7 @@ void Title() __menuet__write_text(600,8,0x00ffffff,title3,strlen(title3)); } -void draw_window(void) +static void draw_window(void) { // start redraw __menuet__window_redraw(1); @@ -182,7 +182,7 @@ void draw_window(void) Title(); } -void app_main(void) +int main(void) { win.x = 100; @@ -241,11 +241,11 @@ do{ break; case KEY_ESC: disabletgl(); - return;} + return 0;} break; case 3: disabletgl(); - return; + return 0; } }while(1); } diff --git a/programs/demos/cubetext/trunk/ProcessTab.h b/programs/demos/cubetext/trunk/ProcessTab.h index 320a6dbb5e..104e607f92 100644 --- a/programs/demos/cubetext/trunk/ProcessTab.h +++ b/programs/demos/cubetext/trunk/ProcessTab.h @@ -1,24 +1,26 @@ +#pragma pack(push, 1) struct process_table_entry_ { - __u32 cpu_usage __attribute__((packed)); - __u16 pos_in_windowing_stack __attribute__((packed)); - __u16 win_stack_val_at_ecx __attribute__((packed)); - __u16 rez1 __attribute__((packed)); - char name[11] __attribute__((packed)); - __u8 rez2 __attribute__((packed)); - __u32 memstart __attribute__((packed)); - __u32 memused __attribute__((packed)); - __u32 pid __attribute__((packed)); - __u32 winx_start,winy_start __attribute__((packed)); - __u32 winx_size,winy_size __attribute__((packed)); - __u8 slot __attribute__((packed)); - __u8 rez3 __attribute__((packed)); - __u32 clarx_start,clary_start __attribute__((packed)); - __u32 clarx_size,clary_size __attribute__((packed)); - __u8 win_condition __attribute__((packed)); - __u8 buf[955] __attribute__((packed)); -} __attribute__((packed)); + __u32 cpu_usage; + __u16 pos_in_windowing_stack; + __u16 win_stack_val_at_ecx; + __u16 rez1; + char name[11]; + __u8 rez2; + __u32 memstart; + __u32 memused; + __u32 pid; + __u32 winx_start,winy_start; + __u32 winx_size,winy_size; + __u8 slot; + __u8 rez3; + __u32 clarx_start,clary_start; + __u32 clarx_size,clary_size; + __u8 win_condition; + __u8 buf[955]; +}; +#pragma pack(pop) #define TYPEWIN(D,C,B,A,Y,RR,GG,BB) (D<<31)|(C<<30)|(B<<29)|(A<<28)|(Y<<24)|\ (RR<<16)|(GG<<8)|BB diff --git a/programs/demos/cubetext/trunk/Tupfile.lua b/programs/demos/cubetext/trunk/Tupfile.lua new file mode 100644 index 0000000000..b4de324565 --- /dev/null +++ b/programs/demos/cubetext/trunk/Tupfile.lua @@ -0,0 +1,7 @@ +if tup.getconfig("NO_GCC") ~= "" then return end +HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../.." or tup.getconfig("HELPERDIR") +tup.include(HELPERDIR .. "/use_gcc.lua") +tup.include(HELPERDIR .. "/use_menuetlibc.lua") +tup.include(HELPERDIR .. "/use_tinygl.lua") +compile_gcc{"*.cpp"} +link_gcc("cubetext") diff --git a/programs/demos/cubetext/trunk/main.cpp b/programs/demos/cubetext/trunk/main.cpp index 313e3cd171..3c8c69cabb 100644 --- a/programs/demos/cubetext/trunk/main.cpp +++ b/programs/demos/cubetext/trunk/main.cpp @@ -14,7 +14,7 @@ iadn@bk.ru int Fps (long x, long y); extern "C"{ -void app_main(void); +int main(void); } struct { @@ -132,7 +132,7 @@ void draw_window(void) Title(); } -void app_main(void) +int main(void) { win.x = 100; @@ -211,11 +211,11 @@ do{ break; case KEY_ESC: disabletgl(); - return;} + return 0;} break; case 3: disabletgl(); - return; + return 0; } }while(1); } diff --git a/programs/demos/eyes/trunk/Tupfile.lua b/programs/demos/eyes/trunk/Tupfile.lua new file mode 100644 index 0000000000..6a5daef710 --- /dev/null +++ b/programs/demos/eyes/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"eyes.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "eyes") diff --git a/programs/demos/fire/trunk/Tupfile.lua b/programs/demos/fire/trunk/Tupfile.lua new file mode 100644 index 0000000000..689f3f7e32 --- /dev/null +++ b/programs/demos/fire/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("fire.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "fire") diff --git a/programs/demos/fire2/trunk/Tupfile.lua b/programs/demos/fire2/trunk/Tupfile.lua new file mode 100644 index 0000000000..c71a13a517 --- /dev/null +++ b/programs/demos/fire2/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("fire2.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "fire2") diff --git a/programs/demos/firework/trunk/Tupfile.lua b/programs/demos/firework/trunk/Tupfile.lua new file mode 100644 index 0000000000..2cbe1a425a --- /dev/null +++ b/programs/demos/firework/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("firework.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "firework") diff --git a/programs/demos/flatwav/trunk/Tupfile.lua b/programs/demos/flatwav/trunk/Tupfile.lua new file mode 100644 index 0000000000..9b8a920c09 --- /dev/null +++ b/programs/demos/flatwav/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("FLATWAV.ASM", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "FLATWAV") diff --git a/programs/demos/free3d/trunk/Tupfile.lua b/programs/demos/free3d/trunk/Tupfile.lua new file mode 100644 index 0000000000..33e95b0a14 --- /dev/null +++ b/programs/demos/free3d/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("free3d.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "free3d") diff --git a/programs/demos/free3d04/trunk/Tupfile.lua b/programs/demos/free3d04/trunk/Tupfile.lua new file mode 100644 index 0000000000..a5b6f98f98 --- /dev/null +++ b/programs/demos/free3d04/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"free3d04.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "free3d04") diff --git a/programs/demos/gears/trunk/ProcessTab.h b/programs/demos/gears/trunk/ProcessTab.h index 320a6dbb5e..104e607f92 100644 --- a/programs/demos/gears/trunk/ProcessTab.h +++ b/programs/demos/gears/trunk/ProcessTab.h @@ -1,24 +1,26 @@ +#pragma pack(push, 1) struct process_table_entry_ { - __u32 cpu_usage __attribute__((packed)); - __u16 pos_in_windowing_stack __attribute__((packed)); - __u16 win_stack_val_at_ecx __attribute__((packed)); - __u16 rez1 __attribute__((packed)); - char name[11] __attribute__((packed)); - __u8 rez2 __attribute__((packed)); - __u32 memstart __attribute__((packed)); - __u32 memused __attribute__((packed)); - __u32 pid __attribute__((packed)); - __u32 winx_start,winy_start __attribute__((packed)); - __u32 winx_size,winy_size __attribute__((packed)); - __u8 slot __attribute__((packed)); - __u8 rez3 __attribute__((packed)); - __u32 clarx_start,clary_start __attribute__((packed)); - __u32 clarx_size,clary_size __attribute__((packed)); - __u8 win_condition __attribute__((packed)); - __u8 buf[955] __attribute__((packed)); -} __attribute__((packed)); + __u32 cpu_usage; + __u16 pos_in_windowing_stack; + __u16 win_stack_val_at_ecx; + __u16 rez1; + char name[11]; + __u8 rez2; + __u32 memstart; + __u32 memused; + __u32 pid; + __u32 winx_start,winy_start; + __u32 winx_size,winy_size; + __u8 slot; + __u8 rez3; + __u32 clarx_start,clary_start; + __u32 clarx_size,clary_size; + __u8 win_condition; + __u8 buf[955]; +}; +#pragma pack(pop) #define TYPEWIN(D,C,B,A,Y,RR,GG,BB) (D<<31)|(C<<30)|(B<<29)|(A<<28)|(Y<<24)|\ (RR<<16)|(GG<<8)|BB diff --git a/programs/demos/gears/trunk/Tupfile.lua b/programs/demos/gears/trunk/Tupfile.lua new file mode 100644 index 0000000000..9113f3762c --- /dev/null +++ b/programs/demos/gears/trunk/Tupfile.lua @@ -0,0 +1,7 @@ +if tup.getconfig("NO_GCC") ~= "" then return end +HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../.." or tup.getconfig("HELPERDIR") +tup.include(HELPERDIR .. "/use_gcc.lua") +tup.include(HELPERDIR .. "/use_menuetlibc.lua") +tup.include(HELPERDIR .. "/use_tinygl.lua") +compile_gcc{"fps.cpp", "main.cpp"} +link_gcc("gears") diff --git a/programs/demos/gears/trunk/main.cpp b/programs/demos/gears/trunk/main.cpp index 5694d99744..093e2d23a0 100644 --- a/programs/demos/gears/trunk/main.cpp +++ b/programs/demos/gears/trunk/main.cpp @@ -22,7 +22,7 @@ iadn@bk.ru int Fps (long x, long y); extern "C"{ -void app_main(void); +int main(void); } struct { @@ -255,7 +255,7 @@ void draw_window(void) Title(); } -void app_main(void) +int main(void) { win.x = 100; @@ -335,11 +335,11 @@ do{ break; case KEY_ESC: disabletgl(); - return;} + return 0;} break; case 3: disabletgl(); - return; + return 0; } }while(1); } diff --git a/programs/demos/life/trunk/Tupfile.lua b/programs/demos/life/trunk/Tupfile.lua new file mode 100644 index 0000000000..d87ce9d5a5 --- /dev/null +++ b/programs/demos/life/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"life.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "life") diff --git a/programs/demos/magnify/trunk/Tupfile.lua b/programs/demos/magnify/trunk/Tupfile.lua new file mode 100644 index 0000000000..b7bf47d0b0 --- /dev/null +++ b/programs/demos/magnify/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"magnify.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "magnify") diff --git a/programs/demos/movback/trunk/Tupfile.lua b/programs/demos/movback/trunk/Tupfile.lua new file mode 100644 index 0000000000..ccd160d789 --- /dev/null +++ b/programs/demos/movback/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"movback.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "movback") diff --git a/programs/demos/plasma/trunk/Tupfile.lua b/programs/demos/plasma/trunk/Tupfile.lua new file mode 100644 index 0000000000..ad704145f6 --- /dev/null +++ b/programs/demos/plasma/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"plasma.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "plasma") diff --git a/programs/demos/qjulia/trunk/Tupfile.lua b/programs/demos/qjulia/trunk/Tupfile.lua new file mode 100644 index 0000000000..4cddbe7763 --- /dev/null +++ b/programs/demos/qjulia/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("QJULIA.ASM", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "QJULIA") diff --git a/programs/demos/timer/trunk/Tupfile.lua b/programs/demos/timer/trunk/Tupfile.lua new file mode 100644 index 0000000000..564aba7633 --- /dev/null +++ b/programs/demos/timer/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"timer.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "timer") diff --git a/programs/demos/tinyfrac/trunk/Tupfile.lua b/programs/demos/tinyfrac/trunk/Tupfile.lua new file mode 100644 index 0000000000..88c02303b9 --- /dev/null +++ b/programs/demos/tinyfrac/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"tinyfrac.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "tinyfrac") diff --git a/programs/demos/transp/trunk/Tupfile.lua b/programs/demos/transp/trunk/Tupfile.lua new file mode 100644 index 0000000000..e26502c644 --- /dev/null +++ b/programs/demos/transp/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"transp.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "transp") diff --git a/programs/demos/trantest/trunk/Tupfile.lua b/programs/demos/trantest/trunk/Tupfile.lua new file mode 100644 index 0000000000..e5a695b502 --- /dev/null +++ b/programs/demos/trantest/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"trantest.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "trantest") diff --git a/programs/demos/tube/trunk/Tupfile.lua b/programs/demos/tube/trunk/Tupfile.lua new file mode 100644 index 0000000000..63483cc94b --- /dev/null +++ b/programs/demos/tube/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("tube.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "tube") diff --git a/programs/demos/unvwater/trunk/Tupfile.lua b/programs/demos/unvwater/trunk/Tupfile.lua new file mode 100644 index 0000000000..6e9eac3952 --- /dev/null +++ b/programs/demos/unvwater/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"unvwater.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "unvwater") diff --git a/programs/demos/use_mb/Tupfile.lua b/programs/demos/use_mb/Tupfile.lua new file mode 100644 index 0000000000..f1c2641dee --- /dev/null +++ b/programs/demos/use_mb/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"use_mb.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "use_mb") diff --git a/programs/demos/web/trunk/Tupfile.lua b/programs/demos/web/trunk/Tupfile.lua new file mode 100644 index 0000000000..18d5727263 --- /dev/null +++ b/programs/demos/web/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("web.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "web") diff --git a/programs/develop/SPForth/Tupfile.lua b/programs/develop/SPForth/Tupfile.lua new file mode 100644 index 0000000000..79ba3ddd27 --- /dev/null +++ b/programs/develop/SPForth/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"meforth.ASM", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "meforth") diff --git a/programs/develop/asciivju/trunk/Tupfile.lua b/programs/develop/asciivju/trunk/Tupfile.lua new file mode 100644 index 0000000000..7dbfa38f42 --- /dev/null +++ b/programs/develop/asciivju/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("asciivju.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "asciivju") diff --git a/programs/develop/cObj/trunk/Tupfile.lua b/programs/develop/cObj/trunk/Tupfile.lua new file mode 100644 index 0000000000..22ceb1bc6c --- /dev/null +++ b/programs/develop/cObj/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"cObj.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "cObj") diff --git a/programs/develop/examples/checkbox/trunk/Tupfile.lua b/programs/develop/examples/checkbox/trunk/Tupfile.lua new file mode 100644 index 0000000000..ac7f62b281 --- /dev/null +++ b/programs/develop/examples/checkbox/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("checkbox.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "checkbox") diff --git a/programs/develop/examples/circle/trunk/Tupfile.lua b/programs/develop/examples/circle/trunk/Tupfile.lua new file mode 100644 index 0000000000..453fc86fb9 --- /dev/null +++ b/programs/develop/examples/circle/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("circle.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "circle") diff --git a/programs/develop/examples/clipboard/Tupfile.lua b/programs/develop/examples/clipboard/Tupfile.lua new file mode 100644 index 0000000000..61aa04bc63 --- /dev/null +++ b/programs/develop/examples/clipboard/Tupfile.lua @@ -0,0 +1,6 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.foreach_rule( + {"clip_get.asm", "clip_put.asm"}, + "fasm %f %o " .. tup.getconfig("KPACK_CMD"), + "%B" +) diff --git a/programs/develop/examples/cpuspeed/trunk/Tupfile.lua b/programs/develop/examples/cpuspeed/trunk/Tupfile.lua new file mode 100644 index 0000000000..063c3cbb0e --- /dev/null +++ b/programs/develop/examples/cpuspeed/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"cpuspeed.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "cpuspeed") diff --git a/programs/develop/examples/editbox/trunk/Tupfile.lua b/programs/develop/examples/editbox/trunk/Tupfile.lua new file mode 100644 index 0000000000..50cae99523 --- /dev/null +++ b/programs/develop/examples/editbox/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("editbox.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "editbox") diff --git a/programs/develop/examples/editbox/trunk/EDITBOX.INC b/programs/develop/examples/editbox/trunk/editbox.inc similarity index 100% rename from programs/develop/examples/editbox/trunk/EDITBOX.INC rename to programs/develop/examples/editbox/trunk/editbox.inc diff --git a/programs/develop/examples/example2/trunk/Tupfile.lua b/programs/develop/examples/example2/trunk/Tupfile.lua new file mode 100644 index 0000000000..4df254fc4c --- /dev/null +++ b/programs/develop/examples/example2/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"example2.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "example2") diff --git a/programs/develop/examples/example3/trunk/Tupfile.lua b/programs/develop/examples/example3/trunk/Tupfile.lua new file mode 100644 index 0000000000..10f9766d64 --- /dev/null +++ b/programs/develop/examples/example3/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"example3.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "example3") diff --git a/programs/develop/examples/hello/trunk/Tupfile.lua b/programs/develop/examples/hello/trunk/Tupfile.lua new file mode 100644 index 0000000000..bd514f338c --- /dev/null +++ b/programs/develop/examples/hello/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"hello.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "hello") diff --git a/programs/develop/examples/ipc/trunk/Tupfile.lua b/programs/develop/examples/ipc/trunk/Tupfile.lua new file mode 100644 index 0000000000..42f23e3adf --- /dev/null +++ b/programs/develop/examples/ipc/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"ipc.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "ipc") diff --git a/programs/develop/examples/ir/trunk/Tupfile.lua b/programs/develop/examples/ir/trunk/Tupfile.lua new file mode 100644 index 0000000000..3977efd083 --- /dev/null +++ b/programs/develop/examples/ir/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"ir.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "ir") diff --git a/programs/develop/examples/numcalc/trunk/Tupfile.lua b/programs/develop/examples/numcalc/trunk/Tupfile.lua new file mode 100644 index 0000000000..6ee2791069 --- /dev/null +++ b/programs/develop/examples/numcalc/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("@numcalc.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "@numcalc") diff --git a/programs/develop/examples/radiobutton/trunk/Tupfile.lua b/programs/develop/examples/radiobutton/trunk/Tupfile.lua new file mode 100644 index 0000000000..5be342445f --- /dev/null +++ b/programs/develop/examples/radiobutton/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("optionbox.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "optionbox") diff --git a/programs/develop/examples/rtdata/trunk/Tupfile.lua b/programs/develop/examples/rtdata/trunk/Tupfile.lua new file mode 100644 index 0000000000..eaed7d71a6 --- /dev/null +++ b/programs/develop/examples/rtdata/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"rtdata.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "rtdata") diff --git a/programs/develop/examples/template/trunk/Tupfile.lua b/programs/develop/examples/template/trunk/Tupfile.lua new file mode 100644 index 0000000000..6ce5d920cb --- /dev/null +++ b/programs/develop/examples/template/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"template.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "template") diff --git a/programs/develop/examples/thread/trunk/Tupfile.lua b/programs/develop/examples/thread/trunk/Tupfile.lua new file mode 100644 index 0000000000..ce77117f71 --- /dev/null +++ b/programs/develop/examples/thread/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"thread.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "thread") diff --git a/programs/develop/fasm/trunk/Tupfile.lua b/programs/develop/fasm/trunk/Tupfile.lua new file mode 100644 index 0000000000..c6f8d0d197 --- /dev/null +++ b/programs/develop/fasm/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"fasm.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "fasm") diff --git a/programs/develop/fast_call_test/Tupfile.lua b/programs/develop/fast_call_test/Tupfile.lua new file mode 100644 index 0000000000..1c01ce1ba7 --- /dev/null +++ b/programs/develop/fast_call_test/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("test.ASM", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "test") diff --git a/programs/develop/h2d2b/trunk/Tupfile.lua b/programs/develop/h2d2b/trunk/Tupfile.lua new file mode 100644 index 0000000000..3f6f327fb5 --- /dev/null +++ b/programs/develop/h2d2b/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"h2d2b.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "h2d2b") diff --git a/programs/develop/heed/trunk/Tupfile.lua b/programs/develop/heed/trunk/Tupfile.lua new file mode 100644 index 0000000000..3cb86217af --- /dev/null +++ b/programs/develop/heed/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"heed.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "heed") diff --git a/programs/develop/hexview/trunk/Tupfile.lua b/programs/develop/hexview/trunk/Tupfile.lua new file mode 100644 index 0000000000..36a3a82f4f --- /dev/null +++ b/programs/develop/hexview/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"hexview.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "hexview") diff --git a/programs/develop/info3ds/Tupfile.lua b/programs/develop/info3ds/Tupfile.lua new file mode 100644 index 0000000000..fcb41193cc --- /dev/null +++ b/programs/develop/info3ds/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"info3ds.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "info3ds") diff --git a/programs/develop/keyascii/trunk/Tupfile.lua b/programs/develop/keyascii/trunk/Tupfile.lua new file mode 100644 index 0000000000..5f57fa0a51 --- /dev/null +++ b/programs/develop/keyascii/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"keyascii.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "keyascii") diff --git a/programs/develop/kol_f_edit/Tupfile.lua b/programs/develop/kol_f_edit/Tupfile.lua new file mode 100644 index 0000000000..dfcb1e967e --- /dev/null +++ b/programs/develop/kol_f_edit/Tupfile.lua @@ -0,0 +1,4 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"kol_f_edit.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "bin/kol_f_edit") +tup.rule({"ob_o.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o", "bin/ob_o.opt") diff --git a/programs/develop/libraries/TinyGL/BeOS/GLView.cpp b/programs/develop/libraries/TinyGL/BeOS/GLView.cpp new file mode 100644 index 0000000000..778107e62d --- /dev/null +++ b/programs/develop/libraries/TinyGL/BeOS/GLView.cpp @@ -0,0 +1,205 @@ +#include "GLView.h" +#include +#include + +BLocker BGLView::locker; + +BGLView::BGLView(BRect rect, char *name, + ulong resizingMode, ulong mode, + ulong options) + : BView(rect, name, resizingMode, mode|B_FRAME_EVENTS|B_WILL_DRAW) +{ +#ifdef __INTEL__ + color_space cs = B_RGB16_LITTLE; +#else + color_space cs = B_RGB16_BIG; +#endif + this->bitmaps[0] = new BBitmap(rect, cs, false, true); + this->bitmaps[1] = new BBitmap(rect, cs, false, true); + + this->currBitmap = 0; + int w = this->bitmaps[0]->BytesPerRow() / 2; + int h = rect.Height() + 1; + void *buffers[2]; + buffers[0] = this->bitmaps[0]->Bits(); + buffers[1] = this->bitmaps[1]->Bits(); + this->context = ostgl_create_context(w, h, 16, buffers, 2); + ostgl_make_current(this->context, 0); +} + +BGLView::~BGLView() +{ + ostgl_delete_context(this->context); + delete this->bitmaps[0]; + delete this->bitmaps[1]; +} + +void +BGLView::LockGL() +{ + BGLView::locker.Lock(); + ostgl_make_current(this->context, this->currBitmap); +} + +void +BGLView::UnlockGL() +{ + BGLView::locker.Unlock(); +} + +void +BGLView::SwapBuffers() +{ + if (Window()->Lock()) { + DrawBitmap(this->bitmaps[this->currBitmap]); + Window()->Unlock(); + this->currBitmap ^= 1; + } +} + +/* +BView * +BGLView::EmbeddedView() +{ + return NULL; +} + +status_t +BGLView::CopyPixelsOut(BPoint source, BBitmap *dest) +{ + assert(0); + return 0; +} + +status_t +BGLView::CopyPixelsIn(BBitmap *source, BPoint dest) +{ + assert(0); + return 0; +} +*/ + +void +BGLView::ErrorCallback(GLenum /*errorCode*/) +{ +} + +void +BGLView::Draw(BRect rect) +{ + //fprintf(stderr, "GLView::Draw()"); + DrawBitmap(this->bitmaps[this->currBitmap^1], rect, rect); +} + +void +BGLView::AttachedToWindow() +{ +} + +void +BGLView::AllAttached() +{ +} + +void +BGLView::DetachedFromWindow() +{ +} + +void +BGLView::AllDetached() +{ +} + +void +BGLView::FrameResized(float w, float h) +{ + delete this->bitmaps[0]; + delete this->bitmaps[1]; +#ifdef __INTEL__ + color_space cs = B_RGB16_LITTLE; +#else + color_space cs = B_RGB16_BIG; +#endif + this->bitmaps[0] = new BBitmap(BRect(0,0, w-1, h-1), + cs, false, true); + this->bitmaps[1] = new BBitmap(BRect(0,0, w-1, h-1), + cs, false, true); + int w2 = this->bitmaps[0]->BytesPerRow() / 2; + void *buffers[2]; + buffers[0] = this->bitmaps[0]->Bits(); + buffers[1] = this->bitmaps[1]->Bits(); + ostgl_resize(this->context, w2, h, buffers); +} + +/* +status_t +BGLView::Perform(perform_code d, void *arg) +{ + +} +*/ + +// +// the rest are pass-through functions +// + +status_t +BGLView::Archive(BMessage *data, bool deep) const +{ + return BView::Archive(data, deep); +} + +void +BGLView::MessageReceived(BMessage *msg) +{ + BView::MessageReceived(msg); +} + +void +BGLView::SetResizingMode(uint32 mode) +{ + BView::SetResizingMode(mode); +} + +void +BGLView::Show() +{ + BView::Show(); +} + +void +BGLView::Hide() +{ + BView::Hide(); +} + +BHandler * +BGLView::ResolveSpecifier(BMessage *msg, int32 index, + BMessage *specifier, int32 form, + const char *property) +{ + return BView::ResolveSpecifier(msg, index, specifier, form, property); +} + +status_t +BGLView::GetSupportedSuites(BMessage *data) +{ + return BView::GetSupportedSuites(data); +} + +/* +void +BGLView::DirectConnected( direct_buffer_info *info ) +{ + BView::DirectConnected(info); +} +*/ + +/* +void +BGLView::EnableDirectMode( bool enabled ) +{ + BView::EnableDirectMode(enabled); +} +*/ diff --git a/programs/develop/libraries/TinyGL/BeOS/GLView.h b/programs/develop/libraries/TinyGL/BeOS/GLView.h new file mode 100644 index 0000000000..6791e5aac0 --- /dev/null +++ b/programs/develop/libraries/TinyGL/BeOS/GLView.h @@ -0,0 +1,72 @@ +#ifndef _glview_h_ +#define _glview_h_ + +#define BGL_RGB 0 +#define BGL_INDEX 1 +#define BGL_SINGLE 0 +#define BGL_DOUBLE 2 +#define BGL_DIRECT 0 +#define BGL_INDIRECT 4 +#define BGL_ACCUM 8 +#define BGL_ALPHA 16 +#define BGL_DEPTH 32 +#define BGL_OVERLAY 64 +#define BGL_UNDERLAY 128 +#define BGL_STENCIL 512 + +#include +#include +#include +#include +#include +#include + +class BGLView : public BView { +public: + BGLView(BRect rect, char *name, + ulong resizingMode, ulong mode, + ulong options); + virtual ~BGLView(); + + void LockGL(); + void UnlockGL(); + void SwapBuffers(); +// BView *EmbeddedView(); +// status_t CopyPixelsOut(BPoint source, BBitmap *dest); +// status_t CopyPixelsIn(BBitmap *source, BPoint dest); + + virtual void ErrorCallback(GLenum errorCode); + virtual void Draw(BRect updateRect); + virtual void AttachedToWindow(); + virtual void AllAttached(); + virtual void DetachedFromWindow(); + virtual void AllDetached(); + virtual void FrameResized(float width, float height); +// virtual status_t Perform(perform_code d, void *arg); + + // + // Methods below are pass-throughs to BView for the moment. + // + + virtual status_t Archive(BMessage *data, bool deep = true) const; + virtual void MessageReceived(BMessage *msg); + virtual void SetResizingMode(uint32 mode); + + virtual void Show(); + virtual void Hide(); + + virtual BHandler *ResolveSpecifier(BMessage *msg, int32 index, + BMessage *specifier, int32 form, + const char *property); + virtual status_t GetSupportedSuites(BMessage *data); + //void DirectConnected( direct_buffer_info *info ); + //void EnableDirectMode( bool enabled ); + +private: + ostgl_context *context; + BBitmap *bitmaps[2]; + int currBitmap; + static BLocker locker; +}; + +#endif // _glview_h_ diff --git a/programs/develop/libraries/TinyGL/BeOS/Makefile b/programs/develop/libraries/TinyGL/BeOS/Makefile new file mode 100644 index 0000000000..0113b3f6f0 --- /dev/null +++ b/programs/develop/libraries/TinyGL/BeOS/Makefile @@ -0,0 +1,16 @@ +OBJS=GLView.o +INCLUDES = -I../include +LIB = libGLView.a + +all: $(LIB) + +$(LIB): $(OBJS) + rm -f $(LIB) + ar rcs $(LIB) $(OBJS) + cp $(LIB) ../lib + +clean: + rm -f *~ *.o *.a + +GLView.o: GLView.cpp GLView.h + $(CC) $(CFLAGS) $(INCLUDES) -c GLView.cpp diff --git a/programs/develop/libraries/TinyGL/Changelog b/programs/develop/libraries/TinyGL/Changelog new file mode 100644 index 0000000000..0055dad764 --- /dev/null +++ b/programs/develop/libraries/TinyGL/Changelog @@ -0,0 +1,48 @@ +version 0.41: iadn +- support for KolibriOS (added kosgl.h, kosgl.c, + modifications zfeatures.h, glColor4f, glColor4fv, glMaterialfv, glClearColor, ZB_resize) +- added module glu in library +- added gluLookAt, RGBFtoRGBI +- modifications ZB_open, gl_malloc, gl_free, gl_zalloc, gl_get_context +- fixed bug in gl_draw_line, updateTmp, gl_draw_triangle_clip, zline.h (for INTERP_RGB definition r,g,b ) +- TINYGL library tells where is library extracted +- build on mingw + +version 0.4: + - added 24/32 bit rendering support (Olivier Landemarre - F. Bellard) + - fixed GL_TRIANGLE_STRIP (Olivier Landemarre) + - added gl_malloc, gl_free, gl_zalloc wrappers (Olivier Landemarre) + +version 0.3: + - added NanoX API (nglx) (F. Bellard) + - added gears example and unified GUI in examples (F. Bellard) + - added TGL_FEATURE_RENDER_BITS so that it will be possible to render + natively in 15/16/24 or 32 bits. (F. Bellard) + - interpolated lines (Olivier Landemarre) + - fast no shading case (Olivier Landemarre) + - fast no projection case (Olivier Landemarre) + +version 0.2: Fabrice Bellard + - added 24/32 bpp support. Added some features.h ifdefs. + - fixed some error reporting cases in the examples + - endianness is deduced from the glibc (BYTE_ORDER macro) + +version 0.19: Peder Blekken + - new files BeOS/* src/msghandling.*, src/arrays.*, src/oscontext.c + include/GL/oscontext.h src/features.h + - added support for BeOS, see README.BEOS + - added support for drawing convex polygons with unlimited # of vertices + - added support for GL_LIGHT_MODEL_TWO_SIDE + - added generic rotation code for glopRotate + - added support for opengl 1.1 arrays + - added support for glPolygonOffset, not implemented. + - added glGetFloatv, limited support. + - added some pnames for glGetIntegerv + - added some empty functions in include/GL/gl.h to compile VRMLView + - added GL_VERSION_1_1 define in include/GL/gl.h + - fixed "bug" when context->gl_resize_viewport is not set. + - fixed bug in glBindTexture (didn't accept texture object 0) + +version 0.1: + - Initial revision, Fabrice Bellard + diff --git a/programs/develop/libraries/TinyGL/INSTALL b/programs/develop/libraries/TinyGL/INSTALL new file mode 100644 index 0000000000..2a9d7f1378 --- /dev/null +++ b/programs/develop/libraries/TinyGL/INSTALL @@ -0,0 +1,10 @@ +Installation: + +- Edit config.mk and change what is needed. You can also look at +src/zfeatures.h to change very specific details (only useful to tune +TinyGL to your needs). You can link the examples with either OpenGL, +Mesa or TinyGL. + +- Type 'make'. The library 'libTinyGL.a' is copied into './lib'. The +examples are build in './examples'. Only the directories './lib' and +'./include' are needed to use TinyGL from another program. diff --git a/programs/develop/libraries/TinyGL/Install.ru b/programs/develop/libraries/TinyGL/Install.ru new file mode 100644 index 0000000000..926451bd91 --- /dev/null +++ b/programs/develop/libraries/TinyGL/Install.ru @@ -0,0 +1,7 @@ + menuetlibc . + TINYGL + . + make. + +'./include' - +'./lib ' - diff --git a/programs/develop/libraries/TinyGL/LICENCE b/programs/develop/libraries/TinyGL/LICENCE new file mode 100644 index 0000000000..eefacaf95b --- /dev/null +++ b/programs/develop/libraries/TinyGL/LICENCE @@ -0,0 +1,22 @@ +Copyright notice: + + (C) 1997-1998 Fabrice Bellard + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product and its documentation + *is* required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + +If you redistribute modified sources, I would appreciate that you +include in the files history information documenting your changes. diff --git a/programs/develop/libraries/TinyGL/LIMITATIONS b/programs/develop/libraries/TinyGL/LIMITATIONS new file mode 100644 index 0000000000..a20a8639ac --- /dev/null +++ b/programs/develop/libraries/TinyGL/LIMITATIONS @@ -0,0 +1,206 @@ + +Here are listed the functions that TinyGL understands with the known +limitations. The non mentionned functions are *not* implemented and +must not be used. + + +************ glEnable / glDisable + +- The following flags are handled: + +GL_CULL_FACE, GL_LIGHTING, GL_COLOR_MATERIAL, GL_TEXTURE_2D, GL_NORMALIZE, +GL_LIGHTx, GL_POLYGON_OFFSET_FILL, GL_POLYGON_OFFSET_POINT, +GL_POLYGON_OFFSET_LINE + + +- GL_DEPTH_TEST is accepted, but it is only used for lines. For all + other primitives, Z buffer use is assumed. The DepthMode is + hardcoded as GL_LESS (OpenGL default). + +************ glShadeModel + +OK. + +************ glCullFace + +OK. + +************ glPolygonMode + +OK. + +************ glBegin + +No tests are performed to prevent some functions of being executed +between glBegin/glEnd. + +************ glEnd + +OK. + +************ glVertex + +Some prototypes are not implemented. + + +************ glColor + +Some prototypes are not implemented. + +************ glNormal + +Some prototypes are not implemented. + +************ glTexCoord + +- Some prototypes are not implemented. + +- The Matrix transformation is not applied yet. + +************ glEdgeFlag + +OK. The edge handling has to be tested, although it is not much useful +in TinyGL. + +************ glMatrixMode / glLoadMatrixf / glLoadIdentity / glMultMatrixf / + glPushMatrix / glPopMatrix / glRotatef / glTranslatef / glScalef / + glFrustum + +- The prototypes with doubles are not implemented. + +************ glViewport + +GlViewport calls a function pointers to tell glx (or another display +system) to resize the Z buffer and the ximage. Made optional in +version 0.2. + +************ glGenLists / glIsList / glNewList / glEndList / glCallList + +OK. + +************ glClear / glClearColor / glClearDepth + +The whole zbuffer and the colors are cleared in any case. The clear color +can be redefined, by *not* the initial z value. + +************ glRenderMode + +Only the modes GL_RENDER and GL_SELECT are implemented. + +************ glSelectBuffer / glInitNames / glPushName / glPopName / glLoadName + +OK. + +************ glGenTextures / glDeleteTextures / glBindTexture + +OK. These functions should be used to get the maximum performance with +TinyGL. + +************ glTexImage2D + +The function accepts only RGB UNSIGNED_BYTES bitmaps. They are +internally resized to 256x256 so you'd better use that size. No +mipmapping is implemented although it will come if asked. No borders +are implemented. + +************ glTexEnvi + +The only supported mode is GL_DECAL, although others are planned if +asked. + + +************ glTexParameteri + +The other prototypes are not implemented. Only the follwing mode are +implemented: + + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + +************ glPixelStorei + +The pixels are alware byte aligned. + +************ glMaterialfv / glMaterialf / glColorMaterial + +OK. + + +************ glLightfv / glLightf / glLightModeli / glLightModelfv + +OK. The OpenGL lightening is implemented but not optimized. + + +************ glFlush + +Ignored. + +************ glHint + +Ignored. + +************ glGetIntegerv + +- only GL_VIEWPORT, GL_MAX_MODELVIEW_STACK_DEPTH, +GL_MAX_PROJECTION_STACK_DEPTH, GL_MAX_LIGHTS, GL_MAX_TEXTURE_SIZE, +GL_MAX_TEXTURE_STACK_DEPTH + +************ glGetIntegerv + +- only GL_TEXTURE_MATRIX, GL_PROJECTION_MATRIX, GL_MODELVIEW_MATRIX, +GL_LINE_WIDTH, GL_LINE_WIDTH_RANGE, GL_POINT_SIZE, GL_POINT_SIZE_RANGE + +************ glPolygonOffset + +- only API implemented. + +************ glEnableClientState, glDisableClientState, + +- No support for GL_INDEX_ARRAY_POINTER or GL_EDGE_FLAG_ARRAY_POINTER + +************ glVertexPointer, glNormalPointer, + glColorPointer, glTexureCoordPointer + +- OK + +------------------------------------------------------------------------------ + +TinyGL GLX emulation: + + +************ glXQueryExtension + +Returns always True + +************ glXChooseVisual + +Only 8 bit Pseudocolor or 16 bit Truecolor Visual are accepted. The +attribute list is ignored. + +************ glXCreateContext + +The sharing is not implemented although the code could handle it. + +************ glXDestroyContext + +OK. + +************ glXMakeCurrent + +Not all the syntax is supported yet, in particular with the 'NULL' or +'None' parameters. + + +************ glXSwapBuffers + +OK. + +************ glXWaitGL / glXWaitX + +Ignored. + + +See README.BEOS for BeOS limitations. + diff --git a/programs/develop/libraries/TinyGL/Makefile b/programs/develop/libraries/TinyGL/Makefile new file mode 100644 index 0000000000..c2f3b88b64 --- /dev/null +++ b/programs/develop/libraries/TinyGL/Makefile @@ -0,0 +1,7 @@ + +all: + make -C src + + +clean: + make -C src clean diff --git a/programs/develop/libraries/TinyGL/README b/programs/develop/libraries/TinyGL/README new file mode 100644 index 0000000000..82421e108b --- /dev/null +++ b/programs/develop/libraries/TinyGL/README @@ -0,0 +1,150 @@ +TinyGL 0.4 (c) 1997-2002 Fabrice Bellard. + +General Description: +-------------------- + +TinyGL is intended to be a very small implementation of a subset of +OpenGL* for embedded systems or games. It is a software only +implementation. Only the main OpenGL calls are implemented. All the +calls I considered not important are simply *not implemented*. + +The main strength of TinyGL is that it is fast and simple because it +has not to be exactly compatible with OpenGL. In particular, the +texture mapping and the geometrical transformations are very fast. + +The main features of TinyGL are: + +- Header compatible with OpenGL (the headers are adapted from the very good +Mesa by Brian Paul et al.) + +- Zlib-like licence for easy integration in commercial designs (read +the LICENCE file). + +- Subset of GLX for easy testing with X Window. + +- GLX like API (NGLX) to use it with NanoX in MicroWindows/NanoX. + +- Subset of BGLView under BeOS. + +- OpenGL like lightening. + +- Complete OpenGL selection mode handling for object picking. + +- 16 bit Z buffer. 16/24/32 bit RGB rendering. High speed dithering to +paletted 8 bits if needed. High speed conversion to 24 bit packed +pixel or 32 bit RGBA if needed. + +- Fast Gouraud shadding optimized for 16 bit RGB. + +- Fast texture mapping capabilities, with perspective correction and +texture objects. + +- 32 bit float only arithmetic. + +- Very small: compiled code size of about 40 kB on x86. The file + src/zfeatures.h can be used to remove some unused features from + TinyGL. + +- C sources for GCC on 32/64 bit architectures. It has been tested +succesfully on x86-Linux and sparc-Solaris. + +Examples: +--------- + +I took three simple examples from the Mesa package to test the main +functions of TinyGL. You can link them to either TinyGL, Mesa or any +other OpenGL/GLX implementation. You can also compile them with +Microwindows. + +- texobj illustrates the use of texture objects. Its shows the speed +of TinyGL in this case. + +- glutmech comes from the GLUT packages. It is much bigger and slower +because it uses the lightening. I have just included some GLU +functions and suppressed the GLUT related code to make it work. It +shows the display list handling of TinyGL in particular. You can look +at the source code to learn the keys to move the robot. The key 't' +toggles between shaded rendering and wire frame. + +- You can download and compile the VReng project to see that TinyGL +has been successfully used in a big project +(http://www-inf.enst.fr/vreng). + +Architecture: +------------- + +TinyGL is made up four main modules: + +- Mathematical routines (zmath). + +- OpenGL-like emulation (zgl). + +- Z buffer and rasterisation (zbuffer). + +- GLX interface (zglx). + +To use TinyGL in an embedded system, you should look at the GLX layer +and modify it to suit your need. Adding a more user friendly +developper layer (as in Mesa) may be useful. + +Notes - limitations: +-------------------- + +- See the file 'LIMITATIONS' to see the current functions supported by the API. + +- The multithreading could be easily implemented since no global state +is maintainted. The library gets the current context with a function +which can be modified. + +- The lightening is not very fast. I supposed that in most games the +lightening is computed by the 3D engine. + +- Some changes are needed for 64 bit pointers for the handling of +arrays of float with the GLParam union. + +- List sharing is partialy supported in the source, but not by the +current TinyGLX implementation (is it really useful ?). + +- No user clipping planes are supported. + +- No color index mode (no longer useful !) + +- The mipmapping is not implemented. + +- The perspecture correction in the mapping code does not use W but +1/Z. In any 'normal scene' it should work. + +- The resizing of the viewport in TinyGLX ensures that the width and +the height are multiples of 4. This is not optimal because some pixels +of the window may not be refreshed. + +Why ? +----- + +TinyGL was developped as a student project for a Virtual Reality +network system called VReng (see the VReng home page at +http://www-inf.enst.fr/vreng). + +At that time (January 1997), my initial project was to write my own 3D +rasterizer based on some old sources I wrote. But I realized that it +would be better to use OpenGL to work on any platform. My problem was +that I wanted to use texture mapping which was (and is still) quite +slower on many software OpenGL implementation. I could have modified +Mesa to suit my needs, but I really wanted to use my old sources for +that project. + +I finally decided to use the same syntax as OpenGL but with my own +libraries, thinking that later it could ease the porting of VReng to +OpenGL. + +Now VReng is at last compatible with OpenGL, and I managed to patch +TinyGL so that VReng can still work with it without any modifications. + +Since TinyGL may be useful for some people, especially in the world of +embedded designs, I decided to release it 'as is', otherwise, it would +have been lost on my hard disk ! + +------------------------------------------------------------------------------ +* OpenGL(R) is a registered trademark of Silicon Graphics, Inc. +------------------------------------------------------------------------------ +Fabrice Bellard. diff --git a/programs/develop/libraries/TinyGL/config.mk b/programs/develop/libraries/TinyGL/config.mk new file mode 100644 index 0000000000..14a5a2a5f0 --- /dev/null +++ b/programs/develop/libraries/TinyGL/config.mk @@ -0,0 +1,7 @@ +##################################################################### +# C compiler + +CC= gcc +CFLAGS= -c -nodefaultlibs -mmmx -mtune=pentiumpro -O2 -w + + diff --git a/programs/develop/libraries/TinyGL/examples/Makefile b/programs/develop/libraries/TinyGL/examples/Makefile new file mode 100644 index 0000000000..912243bba4 --- /dev/null +++ b/programs/develop/libraries/TinyGL/examples/Makefile @@ -0,0 +1,29 @@ +include ../config.mk + +PROGS = mech texobj gears spin + +all: $(PROGS) + +clean: + rm -f core *.o *~ $(PROGS) + +mech: mech.o glu.o $(UI_OBJS) $(GL_DEPS) + $(CC) $(LFLAGS) $^ -o $@ $(GL_LIBS) $(UI_LIBS) -lm + +texobj: texobj.o $(UI_OBJS) $(GL_DEPS) + $(CC) $(LFLAGS) $^ -o $@ $(GL_LIBS) $(UI_LIBS) -lm + +gears: gears.o $(UI_OBJS) $(GL_DEPS) + $(CC) $(LFLAGS) $^ -o $@ $(GL_LIBS) $(UI_LIBS) -lm + +spin: spin.o $(UI_OBJS) $(GL_DEPS) + $(CC) $(LFLAGS) $^ -o $@ $(GL_LIBS) $(UI_LIBS) -lm + +.c.o: + $(CC) $(CFLAGS) $(GL_INCLUDES) $(UI_INCLUDES) -c $*.c + +mech.o: glu.h + +glu.o: glu.h + +ui.o: ui.h diff --git a/programs/develop/libraries/TinyGL/examples/gears.c b/programs/develop/libraries/TinyGL/examples/gears.c new file mode 100644 index 0000000000..7ccf5bf215 --- /dev/null +++ b/programs/develop/libraries/TinyGL/examples/gears.c @@ -0,0 +1,300 @@ +/* gears.c */ + +/* + * 3-D gear wheels. This program is in the public domain. + * + * Brian Paul + */ + + +#include +#include +#include +#include + +#include +#include +#include "ui.h" + +#ifndef M_PI +# define M_PI 3.14159265 +#endif + + +/* + * Draw a gear wheel. You'll probably want to call this function when + * building a display list since we do a lot of trig here. + * + * Input: inner_radius - radius of hole at center + * outer_radius - radius at center of teeth + * width - width of gear + * teeth - number of teeth + * tooth_depth - depth of tooth + */ +static void gear( GLfloat inner_radius, GLfloat outer_radius, GLfloat width, + GLint teeth, GLfloat tooth_depth ) +{ + GLint i; + GLfloat r0, r1, r2; + GLfloat angle, da; + GLfloat u, v, len; + + r0 = inner_radius; + r1 = outer_radius - tooth_depth/2.0; + r2 = outer_radius + tooth_depth/2.0; + + da = 2.0*M_PI / teeth / 4.0; + + glShadeModel( GL_FLAT ); + + glNormal3f( 0.0, 0.0, 1.0 ); + + /* draw front face */ + glBegin( GL_QUAD_STRIP ); + for (i=0;i<=teeth;i++) { + angle = i * 2.0*M_PI / teeth; + glVertex3f( r0*cos(angle), r0*sin(angle), width*0.5 ); + glVertex3f( r1*cos(angle), r1*sin(angle), width*0.5 ); + glVertex3f( r0*cos(angle), r0*sin(angle), width*0.5 ); + glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), width*0.5 ); + } + glEnd(); + + /* draw front sides of teeth */ + glBegin( GL_QUADS ); + da = 2.0*M_PI / teeth / 4.0; + for (i=0;i1) { + /* do 'n' frames then exit */ + limit = atoi( argv[1] ) + 1; + } + else { + limit = 0; + } + + return ui_loop(argc, argv, "gears"); +} + + diff --git a/programs/develop/libraries/TinyGL/examples/glu.c b/programs/develop/libraries/TinyGL/examples/glu.c new file mode 100644 index 0000000000..38561e71b4 --- /dev/null +++ b/programs/develop/libraries/TinyGL/examples/glu.c @@ -0,0 +1,261 @@ +#include +#include +#include +#include "glu.h" + + +void drawTorus(float rc, int numc, float rt, int numt) +{ + int i, j, k; + double s, t; + double x, y, z; + double pi, twopi; + + pi = 3.14159265358979323846; + twopi = 2 * pi; + + for (i = 0; i < numc; i++) { + glBegin(GL_QUAD_STRIP); + for (j = 0; j <= numt; j++) { + for (k = 1; k >= 0; k--) { + s = (i + k) % numc + 0.5; + t = j % numt; + + x = cos(t*twopi/numt) * cos(s*twopi/numc); + y = sin(t*twopi/numt) * cos(s*twopi/numc); + z = sin(s*twopi/numc); + glNormal3f(x, y, z); + + x = (rt + rc * cos(s*twopi/numc)) * cos(t*twopi/numt); + y = (rt + rc * cos(s*twopi/numc)) * sin(t*twopi/numt); + z = rc * sin(s*twopi/numc); + glVertex3f(x, y, z); + } + } + glEnd(); + } +} + +static void normal3f( GLfloat x, GLfloat y, GLfloat z ) +{ + GLdouble mag; + + mag = sqrt( x*x + y*y + z*z ); + if (mag>0.00001F) { + x /= mag; + y /= mag; + z /= mag; + } + glNormal3f( x, y, z ); +} + +void gluPerspective( GLdouble fovy, GLdouble aspect, + GLdouble zNear, GLdouble zFar ) +{ + GLdouble xmin, xmax, ymin, ymax; + + ymax = zNear * tan( fovy * M_PI / 360.0 ); + ymin = -ymax; + + xmin = ymin * aspect; + xmax = ymax * aspect; + + glFrustum( xmin, xmax, ymin, ymax, zNear, zFar ); +} + +GLUquadricObj *gluNewQuadric(void) +{ + return NULL; +} + +void gluQuadricDrawStyle(GLUquadricObj *obj, int style) +{ +} + +void gluCylinder( GLUquadricObj *qobj, + GLdouble baseRadius, GLdouble topRadius, GLdouble height, + GLint slices, GLint stacks ) +{ + GLdouble da, r, dr, dz; + GLfloat z, nz, nsign; + GLint i, j; + GLfloat du = 1.0 / slices; + GLfloat dv = 1.0 / stacks; + GLfloat tcx = 0.0, tcy = 0.0; + + nsign = 1.0; + + da = 2.0*M_PI / slices; + dr = (topRadius-baseRadius) / stacks; + dz = height / stacks; + nz = (baseRadius-topRadius) / height; /* Z component of normal vectors */ + + for (i=0;i=0;j--) { + theta = (j==slices) ? 0.0 : j * dtheta; + x = -sin(theta) * sin(rho); + y = cos(theta) * sin(rho); + z = nsign * cos(rho); + if (normals) glNormal3f( x*nsign, y*nsign, z*nsign ); + glTexCoord2f(s,1-t); + s -= ds; + glVertex3f( x*radius, y*radius, z*radius ); + } + glEnd(); +} diff --git a/programs/develop/libraries/TinyGL/examples/glu.h b/programs/develop/libraries/TinyGL/examples/glu.h new file mode 100644 index 0000000000..8e4bbdf655 --- /dev/null +++ b/programs/develop/libraries/TinyGL/examples/glu.h @@ -0,0 +1,23 @@ + +void gluPerspective( GLdouble fovy, GLdouble aspect, + GLdouble zNear, GLdouble zFar ); + +typedef struct { + int draw_style; +} GLUquadricObj; + +#define GLU_LINE 0 + +GLUquadricObj *gluNewQuadric(void); +void gluQuadricDrawStyle(GLUquadricObj *obj, int style); + +void gluSphere(GLUquadricObj *qobj, + float radius,int slices,int stacks); +void gluCylinder( GLUquadricObj *qobj, + GLdouble baseRadius, GLdouble topRadius, GLdouble height, + GLint slices, GLint stacks ); +void gluDisk( GLUquadricObj *qobj, + GLdouble innerRadius, GLdouble outerRadius, + GLint slices, GLint loops ); + +void drawTorus(float rc, int numc, float rt, int numt); diff --git a/programs/develop/libraries/TinyGL/examples/mech.c b/programs/develop/libraries/TinyGL/examples/mech.c new file mode 100644 index 0000000000..f071ee39f9 --- /dev/null +++ b/programs/develop/libraries/TinyGL/examples/mech.c @@ -0,0 +1,1753 @@ +/** +* program : glutmech V1.1 +* author : Simon Parkinson-Bates. +* E-mail : sapb@yallara.cs.rmit.edu.au +* Copyright Simon Parkinson-Bates. +* "source if freely avaliable to anyone to copy as long as they +* acknowledge me in their work." +* +* Funtional features +* ------------------ +* * online menu system avaliable by pressing left mouse button +* * online cascading help system avaliable, providing information on +* the several key strokes and what they do. +* * animation sequence coded which makes the mech walk through an +* environment. Shadows will soon be added to make it look +* more realistic. +* * menu control to view mech in wireframe or sold mode. +* * various key strokes avaliable to control idependently the mechs +* many joints. +* * various key strokes avaliable to view mech and environment from +* different angles +* * various key strokes avaliable to alter positioning of the single +* light source. +* +* +* Program features +* ---------------- +* * uses double buffering +* * uses display lists +* * uses glut to manage windows, callbacks, and online menu. +* * uses glpolygonfill() to maintain colors in wireframe and solid +* mode. +* +**/ + +/* start of compilation conditions */ +#define SPHERE +#define COLOR +#define LIGHT +#define TORSO +#define HIP +#define SHOULDER +#define UPPER_ARM +#define LOWER_ARM +#define ROCKET_POD +#define UPPER_LEG +#define LOWER_LEG +#define NO_NORM +#define ANIMATION +#define DRAW_MECH +#define DRAW_ENVIRO +#define MOVE_LIGHT +/* end of compilation conditions */ + +/* start various header files needed */ +#include +#include +#include + +#define GLUT +#define GLUT_KEY +#define GLUT_SPEC +#include +#include +#include "glu.h" +#include "ui.h" + +/* end of header files */ + +/* start of display list definitions */ +#define SOLID_MECH_TORSO 1 +#define SOLID_MECH_HIP 2 +#define SOLID_MECH_SHOULDER 3 +#define SOLID_MECH_UPPER_ARM 4 +#define SOLID_MECH_FOREARM 5 +#define SOLID_MECH_UPPER_LEG 6 +#define SOLID_MECH_FOOT 7 +#define SOLID_MECH_ROCKET 8 +#define SOLID_MECH_VULCAN 9 +#define SOLID_ENVIRO 10 +/* end of display list definitions */ + +/* start of motion rate variables */ +#define ANKLE_RATE 3 +#define HEEL_RATE 3 +#define ROTATE_RATE 10 +#define TILT_RATE 10 +#define ELBOW_RATE 2 +#define SHOULDER_RATE 5 +#define LAT_RATE 5 +#define CANNON_RATE 40 +#define UPPER_LEG_RATE 3 +#define UPPER_LEG_RATE_GROIN 10 +#define LIGHT_TURN_RATE 10 +#define VIEW_TURN_RATE 10 +/* end of motion rate variables */ + +/* start of motion variables */ +#ifndef PI +#define PI 3.141592654 +#endif + +char leg = 0; + +int shoulder1 = 0, shoulder2 = 0, shoulder3 = 0, shoulder4 = 0, lat1 = 20, lat2 = 20, + elbow1 = 0, elbow2 = 0, pivot = 0, tilt = 10, ankle1 = 0, ankle2 = 0, heel1 = 0, + heel2 = 0, hip11 = 0, hip12 = 10, hip21 = 0, hip22 = 10, fire = 0, solid_part = 0, + anim = 0, turn = 0, turn1 = 0, lightturn = 0, lightturn1 = 0; + +float elevation = 0.0, distance = 0.0, frame = 3.0 + /* foot1v[] = {} foot2v[] = {} */ ; + +/* end of motion variables */ + +/* start of material definitions */ +#ifdef LIGHT +GLfloat mat_specular[] = +{0.628281, 0.555802, 0.366065, 1.0}; +GLfloat mat_ambient[] = +{0.24725, 0.1995, 0.0745, 1.0}; +GLfloat mat_diffuse[] = +{0.75164, 0.60648, 0.22648, 1.0}; +GLfloat mat_shininess[] = +{128.0 * 0.4}; + +GLfloat mat_specular2[] = +{0.508273, 0.508273, 0.508373, 1.0}; +GLfloat mat_ambient2[] = +{0.19225, 0.19225, 0.19225, 1.0}; +GLfloat mat_diffuse2[] = +{0.50754, 0.50754, 0.50754, 1.0}; +GLfloat mat_shininess2[] = +{128.0 * 0.6}; + +GLfloat mat_specular3[] = +{0.296648, 0.296648, 0.296648, 1.0}; +GLfloat mat_ambient3[] = +{0.25, 0.20725, 0.20725, 1.0}; +GLfloat mat_diffuse3[] = +{1, 0.829, 0.829, 1.0}; +GLfloat mat_shininess3[] = +{128.0 * 0.088}; + +GLfloat mat_specular4[] = +{0.633, 0.727811, 0.633, 1.0}; +GLfloat mat_ambient4[] = +{0.0215, 0.1745, 0.0215, 1.0}; +GLfloat mat_diffuse4[] = +{0.07568, 0.61424, 0.07568, 1.0}; +GLfloat mat_shininess4[] = +{128 * 0.6}; + +GLfloat mat_specular5[] = +{0.60, 0.60, 0.50, 1.0}; +GLfloat mat_ambient5[] = +{0.0, 0.0, 0.0, 1.0}; +GLfloat mat_diffuse5[] = +{0.5, 0.5, 0.0, 1.0}; +GLfloat mat_shininess5[] = +{128.0 * 0.25}; + +#endif +/* end of material definitions */ + +/* start of the body motion functions */ +void +Heel1Add(void) +{ + heel1 = (heel1 + HEEL_RATE) % 360; +} + +void +Heel1Subtract(void) +{ + heel1 = (heel1 - HEEL_RATE) % 360; +} + +void +Heel2Add(void) +{ + heel2 = (heel2 + HEEL_RATE) % 360; +} + +void +Heel2Subtract(void) +{ + heel2 = (heel2 - HEEL_RATE) % 360; +} + +void +Ankle1Add(void) +{ + ankle1 = (ankle1 + ANKLE_RATE) % 360; +} + +void +Ankle1Subtract(void) +{ + ankle1 = (ankle1 - ANKLE_RATE) % 360; +} + +void +Ankle2Add(void) +{ + ankle2 = (ankle2 + ANKLE_RATE) % 360; +} + +void +Ankle2Subtract(void) +{ + ankle2 = (ankle2 - ANKLE_RATE) % 360; +} + +void +RotateAdd(void) +{ + pivot = (pivot + ROTATE_RATE) % 360; +} + +void +RotateSubtract(void) +{ + pivot = (pivot - ROTATE_RATE) % 360; +} + +void +MechTiltSubtract(void) +{ + tilt = (tilt - TILT_RATE) % 360; +} + +void +MechTiltAdd(void) +{ + tilt = (tilt + TILT_RATE) % 360; +} + +void +elbow1Add(void) +{ + elbow1 = (elbow1 + ELBOW_RATE) % 360; +} + +void +elbow1Subtract(void) +{ + elbow1 = (elbow1 - ELBOW_RATE) % 360; +} + +void +elbow2Add(void) +{ + elbow2 = (elbow2 + ELBOW_RATE) % 360; +} + +void +elbow2Subtract(void) +{ + elbow2 = (elbow2 - ELBOW_RATE) % 360; +} + +void +shoulder1Add(void) +{ + shoulder1 = (shoulder1 + SHOULDER_RATE) % 360; +} + +void +shoulder1Subtract(void) +{ + shoulder1 = (shoulder1 - SHOULDER_RATE) % 360; +} + +void +shoulder2Add(void) +{ + shoulder2 = (shoulder2 + SHOULDER_RATE) % 360; +} + +void +shoulder2Subtract(void) +{ + shoulder2 = (shoulder2 - SHOULDER_RATE) % 360; +} + +void +shoulder3Add(void) +{ + shoulder3 = (shoulder3 + SHOULDER_RATE) % 360; +} + +void +shoulder3Subtract(void) +{ + shoulder3 = (shoulder3 - SHOULDER_RATE) % 360; +} + +void +shoulder4Add(void) +{ + shoulder4 = (shoulder4 + SHOULDER_RATE) % 360; +} + +void +shoulder4Subtract(void) +{ + shoulder4 = (shoulder4 - SHOULDER_RATE) % 360; +} + +void +lat1Raise(void) +{ + lat1 = (lat1 + LAT_RATE) % 360; +} + +void +lat1Lower(void) +{ + lat1 = (lat1 - LAT_RATE) % 360; +} + +void +lat2Raise(void) +{ + lat2 = (lat2 + LAT_RATE) % 360; +} + +void +lat2Lower(void) +{ + lat2 = (lat2 - LAT_RATE) % 360; +} + +void +FireCannon(void) +{ + fire = (fire + CANNON_RATE) % 360; +} + +void +RaiseLeg1Forward(void) +{ + hip11 = (hip11 + UPPER_LEG_RATE) % 360; +} + +void +LowerLeg1Backwards(void) +{ + hip11 = (hip11 - UPPER_LEG_RATE) % 360; +} + +void +RaiseLeg1Outwards(void) +{ + hip12 = (hip12 + UPPER_LEG_RATE_GROIN) % 360; +} + +void +LowerLeg1Inwards(void) +{ + hip12 = (hip12 - UPPER_LEG_RATE_GROIN) % 360; +} + +void +RaiseLeg2Forward(void) +{ + hip21 = (hip21 + UPPER_LEG_RATE) % 360; +} + +void +LowerLeg2Backwards(void) +{ + hip21 = (hip21 - UPPER_LEG_RATE) % 360; +} + +void +RaiseLeg2Outwards(void) +{ + hip22 = (hip22 + UPPER_LEG_RATE_GROIN) % 360; +} + +void +LowerLeg2Inwards(void) +{ + hip22 = (hip22 - UPPER_LEG_RATE_GROIN) % 360; +} + +/* end of body motion functions */ + +/* start of light source position functions */ +void +TurnRight(void) +{ + turn = (turn - VIEW_TURN_RATE) % 360; +} + +void +TurnLeft(void) +{ + turn = (turn + VIEW_TURN_RATE) % 360; +} + +void +TurnForwards(void) +{ + turn1 = (turn1 - VIEW_TURN_RATE) % 360; +} + +void +TurnBackwards(void) +{ + turn1 = (turn1 + VIEW_TURN_RATE) % 360; +} + +void +LightTurnRight(void) +{ + lightturn = (lightturn + LIGHT_TURN_RATE) % 360; +} + +void +LightTurnLeft(void) +{ + lightturn = (lightturn - LIGHT_TURN_RATE) % 360; +} + +void +LightForwards(void) +{ + lightturn1 = (lightturn1 + LIGHT_TURN_RATE) % 360; +} + +void +LightBackwards(void) +{ + lightturn1 = (lightturn1 - LIGHT_TURN_RATE) % 360; +} + +/* end of light source position functions */ + +/* start of geometric shape functions */ +void +Box(float width, float height, float depth, char solid) +{ + char i, j = 0; + float x = width / 2.0, y = height / 2.0, z = depth / 2.0; + + for (i = 0; i < 4; i++) { + glRotatef(90.0, 0.0, 0.0, 1.0); + if (j) { + if (!solid) + glBegin(GL_LINE_LOOP); + else + glBegin(GL_QUADS); + glNormal3f(-1.0, 0.0, 0.0); + glVertex3f(-x, y, z); + glVertex3f(-x, -y, z); + glVertex3f(-x, -y, -z); + glVertex3f(-x, y, -z); + glEnd(); + if (solid) { + glBegin(GL_TRIANGLES); + glNormal3f(0.0, 0.0, 1.0); + glVertex3f(0.0, 0.0, z); + glVertex3f(-x, y, z); + glVertex3f(-x, -y, z); + glNormal3f(0.0, 0.0, -1.0); + glVertex3f(0.0, 0.0, -z); + glVertex3f(-x, -y, -z); + glVertex3f(-x, y, -z); + glEnd(); + } + j = 0; + } else { + if (!solid) + glBegin(GL_LINE_LOOP); + else + glBegin(GL_QUADS); + glNormal3f(-1.0, 0.0, 0.0); + glVertex3f(-y, x, z); + glVertex3f(-y, -x, z); + glVertex3f(-y, -x, -z); + glVertex3f(-y, x, -z); + glEnd(); + if (solid) { + glBegin(GL_TRIANGLES); + glNormal3f(0.0, 0.0, 1.0); + glVertex3f(0.0, 0.0, z); + glVertex3f(-y, x, z); + glVertex3f(-y, -x, z); + glNormal3f(0.0, 0.0, -1.0); + glVertex3f(0.0, 0.0, -z); + glVertex3f(-y, -x, -z); + glVertex3f(-y, x, -z); + glEnd(); + } + j = 1; + } + } +} + +void +Octagon(float side, float height, char solid) +{ + char j; + float x = sin(0.785398163) * side, y = side / 2.0, z = height / 2.0, c; + + c = x + y; + for (j = 0; j < 8; j++) { + glTranslatef(-c, 0.0, 0.0); + if (!solid) + glBegin(GL_LINE_LOOP); + else + glBegin(GL_QUADS); + glNormal3f(-1.0, 0.0, 0.0); + glVertex3f(0.0, -y, z); + glVertex3f(0.0, y, z); + glVertex3f(0.0, y, -z); + glVertex3f(0.0, -y, -z); + glEnd(); + glTranslatef(c, 0.0, 0.0); + if (solid) { + glBegin(GL_TRIANGLES); + glNormal3f(0.0, 0.0, 1.0); + glVertex3f(0.0, 0.0, z); + glVertex3f(-c, -y, z); + glVertex3f(-c, y, z); + glNormal3f(0.0, 0.0, -1.0); + glVertex3f(0.0, 0.0, -z); + glVertex3f(-c, y, -z); + glVertex3f(-c, -y, -z); + glEnd(); + } + glRotatef(45.0, 0.0, 0.0, 1.0); + } +} + +/* end of geometric shape functions */ +#ifdef NORM +void +Normalize(float v[3]) +{ + GLfloat d = sqrt(v[1] * v[1] + v[2] * v[2] + v[3] * v[3]); + + if (d == 0.0) { + printf("zero length vector"); + return; + } + v[1] /= d; + v[2] /= d; + v[3] /= d; +} + +void +NormXprod(float v1[3], float v2[3], float v[3], float out[3]) +{ + GLint i, j; + GLfloat length; + + out[0] = v1[1] * v2[2] - v1[2] * v2[1]; + out[1] = v1[2] * v2[0] - v1[0] * v2[2]; + out[2] = v1[0] * v2[1] - v1[1] * v2[0]; + Normalize(out); +} + +#endif + +void +SetMaterial(GLfloat spec[], GLfloat amb[], GLfloat diff[], GLfloat shin[]) +{ + + glMaterialfv(GL_FRONT, GL_SPECULAR, spec); + glMaterialfv(GL_FRONT, GL_SHININESS, shin); + glMaterialfv(GL_FRONT, GL_AMBIENT, amb); + glMaterialfv(GL_FRONT, GL_DIFFUSE, diff); +} + +void +MechTorso(char solid) +{ + glNewList(SOLID_MECH_TORSO, GL_COMPILE); +#ifdef LIGHT + SetMaterial(mat_specular, mat_ambient, mat_diffuse, mat_shininess); +#endif + glColor3f(1.0, 1.0, 0.0); + Box(1.0, 1.0, 3.0, solid); + glTranslatef(0.75, 0.0, 0.0); +#ifdef LIGHT + SetMaterial(mat_specular2, mat_ambient2, mat_diffuse2, mat_shininess2); +#endif + glColor3f(0.5, 0.5, 0.5); + Box(0.5, 0.6, 2.0, solid); + glTranslatef(-1.5, 0.0, 0.0); + Box(0.5, 0.6, 2.0, solid); + glTranslatef(0.75, 0.0, 0.0); + glEndList(); +} + +void +MechHip(char solid) +{ + int i; + GLUquadricObj *hip[2]; + + glNewList(SOLID_MECH_HIP, GL_COMPILE); +#ifdef LIGHT + SetMaterial(mat_specular, mat_ambient, mat_diffuse, mat_shininess); +#endif + glColor3f(1.0, 1.0, 0.0); + Octagon(0.7, 0.5, solid); +#ifdef SPHERE + for (i = 0; i < 2; i++) { + if (i) + glScalef(-1.0, 1.0, 1.0); + glTranslatef(1.0, 0.0, 0.0); + hip[i] = gluNewQuadric(); +#ifdef LIGHT + SetMaterial(mat_specular2, mat_ambient2, mat_diffuse2, mat_shininess2); +#endif + glColor3f(0.5, 0.5, 0.5); + if (!solid) + gluQuadricDrawStyle(hip[i], GLU_LINE); + gluSphere(hip[0], 0.2, 16, 16); + glTranslatef(-1.0, 0.0, 0.0); + } + glScalef(-1.0, 1.0, 1.0); +#endif + glEndList(); +} + +void +Shoulder(char solid) +{ + GLUquadricObj *deltoid = gluNewQuadric(); + + glNewList(SOLID_MECH_SHOULDER, GL_COMPILE); +#ifdef LIGHT + SetMaterial(mat_specular, mat_ambient, mat_diffuse, mat_shininess); +#endif + glColor3f(1.0, 1.0, 0.0); + Box(1.0, 0.5, 0.5, solid); + glTranslatef(0.9, 0.0, 0.0); +#ifdef LIGHT + SetMaterial(mat_specular2, mat_ambient2, mat_diffuse2, mat_shininess2); +#endif + glColor3f(0.5, 0.5, 0.5); +#ifdef SPHERE + if (!solid) + gluQuadricDrawStyle(deltoid, GLU_LINE); + gluSphere(deltoid, 0.6, 16, 16); +#endif + glTranslatef(-0.9, 0.0, 0.0); + glEndList(); +} + +void +UpperArm(char solid) +{ + GLUquadricObj *upper = gluNewQuadric(); + GLUquadricObj *joint[2]; + GLUquadricObj *joint1[2]; + int i; + + glNewList(SOLID_MECH_UPPER_ARM, GL_COMPILE); +#ifdef LIGHT + SetMaterial(mat_specular, mat_ambient, mat_diffuse, mat_shininess); +#endif + glColor3f(1.0, 1.0, 0.0); + Box(1.0, 2.0, 1.0, solid); + glTranslatef(0.0, -0.95, 0.0); + glRotatef(90.0, 1.0, 0.0, 0.0); +#ifdef LIGHT + SetMaterial(mat_specular2, mat_ambient2, mat_diffuse2, mat_shininess2); +#endif + glColor3f(0.5, 0.5, 0.5); + if (!solid) + gluQuadricDrawStyle(upper, GLU_LINE); + gluCylinder(upper, 0.4, 0.4, 1.5, 16, 10); +#ifdef LIGHT + SetMaterial(mat_specular, mat_ambient, mat_diffuse, mat_shininess); +#endif + glColor3f(1.0, 1.0, 0.0); + glRotatef(-90.0, 1.0, 0.0, 0.0); + glTranslatef(-0.4, -1.85, 0.0); + glRotatef(90.0, 0.0, 1.0, 0.0); + for (i = 0; i < 2; i++) { + joint[i] = gluNewQuadric(); + if (!solid) + gluQuadricDrawStyle(joint[i], GLU_LINE); + if (i) + gluCylinder(joint[i], 0.5, 0.5, 0.8, 16, 10); + else + gluCylinder(joint[i], 0.2, 0.2, 0.8, 16, 10); + } + for (i = 0; i < 2; i++) { + if (i) + glScalef(-1.0, 1.0, 1.0); + joint1[i] = gluNewQuadric(); + if (!solid) + gluQuadricDrawStyle(joint1[i], GLU_LINE); + if (i) + glTranslatef(0.0, 0.0, 0.8); + gluDisk(joint1[i], 0.2, 0.5, 16, 10); + if (i) + glTranslatef(0.0, 0.0, -0.8); + } + glScalef(-1.0, 1.0, 1.0); + glRotatef(-90.0, 0.0, 1.0, 0.0); + glTranslatef(0.4, 2.9, 0.0); + glEndList(); +} + +void +VulcanGun(char solid) +{ + int i; + GLUquadricObj *Barrel[5]; + GLUquadricObj *BarrelFace[5]; + GLUquadricObj *Barrel2[5]; + GLUquadricObj *Barrel3[5]; + GLUquadricObj *BarrelFace2[5]; + GLUquadricObj *Mount = gluNewQuadric(); + GLUquadricObj *Mount_face = gluNewQuadric(); + + glNewList(SOLID_MECH_VULCAN, GL_COMPILE); + +#ifdef LIGHT + SetMaterial(mat_specular2, mat_ambient2, mat_diffuse2, mat_shininess2); +#endif + glColor3f(0.5, 0.5, 0.5); + + if (!solid) { + gluQuadricDrawStyle(Mount, GLU_LINE); + gluQuadricDrawStyle(Mount_face, GLU_LINE); + } + gluCylinder(Mount, 0.5, 0.5, 0.5, 16, 10); + glTranslatef(0.0, 0.0, 0.5); + gluDisk(Mount_face, 0.0, 0.5, 16, 10); + + for (i = 0; i < 5; i++) { + Barrel[i] = gluNewQuadric(); + BarrelFace[i] = gluNewQuadric(); + BarrelFace2[i] = gluNewQuadric(); + Barrel2[i] = gluNewQuadric(); + Barrel3[i] = gluNewQuadric(); + glRotatef(72.0, 0.0, 0.0, 1.0); + glTranslatef(0.0, 0.3, 0.0); + if (!solid) { + gluQuadricDrawStyle(Barrel[i], GLU_LINE); + gluQuadricDrawStyle(BarrelFace[i], GLU_LINE); + gluQuadricDrawStyle(BarrelFace2[i], GLU_LINE); + gluQuadricDrawStyle(Barrel2[i], GLU_LINE); + gluQuadricDrawStyle(Barrel3[i], GLU_LINE); + } + gluCylinder(Barrel[i], 0.15, 0.15, 2.0, 16, 10); + gluCylinder(Barrel3[i], 0.06, 0.06, 2.0, 16, 10); + glTranslatef(0.0, 0.0, 2.0); + gluDisk(BarrelFace[i], 0.1, 0.15, 16, 10); + gluCylinder(Barrel2[i], 0.1, 0.1, 0.1, 16, 5); + glTranslatef(0.0, 0.0, 0.1); + gluDisk(BarrelFace2[i], 0.06, 0.1, 16, 5); + glTranslatef(0.0, -0.3, -2.1); + } + glEndList(); +} + +void +ForeArm(char solid) +{ + char i; + + glNewList(SOLID_MECH_FOREARM, GL_COMPILE); +#ifdef LIGHT + SetMaterial(mat_specular, mat_ambient, mat_diffuse, mat_shininess); +#endif + glColor3f(1.0, 1.0, 0.0); + for (i = 0; i < 5; i++) { + glTranslatef(0.0, -0.1, -0.15); + Box(0.6, 0.8, 0.2, solid); + glTranslatef(0.0, 0.1, -0.15); + Box(0.4, 0.6, 0.1, solid); + } + glTranslatef(0.0, 0.0, 2.45); + Box(1.0, 1.0, 2.0, solid); + glTranslatef(0.0, 0.0, -1.0); + glEndList(); +} + +void +UpperLeg(char solid) +{ + int i; + GLUquadricObj *Hamstring = gluNewQuadric(); + GLUquadricObj *Knee = gluNewQuadric(); + GLUquadricObj *joint[2]; + + glNewList(SOLID_MECH_UPPER_LEG, GL_COMPILE); +#ifdef LIGHT + SetMaterial(mat_specular, mat_ambient, mat_diffuse, mat_shininess); +#endif + glColor3f(1.0, 1.0, 0.0); + if (!solid) { + gluQuadricDrawStyle(Hamstring, GLU_LINE); + gluQuadricDrawStyle(Knee, GLU_LINE); + } + glTranslatef(0.0, -1.0, 0.0); + Box(0.4, 1.0, 0.7, solid); + glTranslatef(0.0, -0.65, 0.0); + for (i = 0; i < 5; i++) { + Box(1.2, 0.3, 1.2, solid); + glTranslatef(0.0, -0.2, 0.0); + Box(1.0, 0.1, 1.0, solid); + glTranslatef(0.0, -0.2, 0.0); + } + glTranslatef(0.0, -0.15, -0.4); + Box(2.0, 0.5, 2.0, solid); + glTranslatef(0.0, -0.3, -0.2); + glRotatef(90.0, 1.0, 0.0, 0.0); +#ifdef LIGHT + SetMaterial(mat_specular2, mat_ambient2, mat_diffuse2, mat_shininess2); +#endif + glColor3f(0.5, 0.5, 0.5); + gluCylinder(Hamstring, 0.6, 0.6, 3.0, 16, 10); +#ifdef LIGHT + SetMaterial(mat_specular, mat_ambient, mat_diffuse, mat_shininess); +#endif + glColor3f(1.0, 1.0, 0.0); + glRotatef(-90.0, 1.0, 0.0, 0.0); + glTranslatef(0.0, -1.5, 1.0); + Box(1.5, 3.0, 0.5, solid); + glTranslatef(0.0, -1.75, -0.8); + Box(2.0, 0.5, 2.0, solid); + glTranslatef(0.0, -0.9, -0.85); +#ifdef LIGHT + SetMaterial(mat_specular2, mat_ambient2, mat_diffuse2, mat_shininess2); +#endif + glColor3f(0.5, 0.5, 0.5); + gluCylinder(Knee, 0.8, 0.8, 1.8, 16, 10); + for (i = 0; i < 2; i++) { + if (i) + glScalef(-1.0, 1.0, 1.0); + joint[i] = gluNewQuadric(); + if (!solid) + gluQuadricDrawStyle(joint[i], GLU_LINE); + if (i) + glTranslatef(0.0, 0.0, 1.8); + gluDisk(joint[i], 0.0, 0.8, 16, 10); + if (i) + glTranslatef(0.0, 0.0, -1.8); + } + glScalef(-1.0, 1.0, 1.0); + glEndList(); +} + +void +Foot(char solid) +{ + + glNewList(SOLID_MECH_FOOT, GL_COMPILE); +#ifdef LIGHT + SetMaterial(mat_specular2, mat_ambient2, mat_diffuse2, mat_shininess2); +#endif + glColor3f(0.5, 0.5, 0.5); + glRotatef(90.0, 1.0, 0.0, 0.0); + Octagon(1.5, 0.6, solid); + glRotatef(-90.0, 1.0, 0.0, 0.0); + glEndList(); +} + +void +LowerLeg(char solid) +{ + float k, l; + GLUquadricObj *ankle = gluNewQuadric(); + GLUquadricObj *ankle_face[2],*joints; + +#ifdef LIGHT + SetMaterial(mat_specular, mat_ambient, mat_diffuse, mat_shininess); +#endif + glColor3f(1.0, 1.0, 0.0); + for (k = 0.0; k < 2.0; k++) { + for (l = 0.0; l < 2.0; l++) { + glPushMatrix(); + glTranslatef(k, 0.0, l); +#ifdef LIGHT + SetMaterial(mat_specular, mat_ambient, mat_diffuse, mat_shininess); +#endif + glColor3f(1.0, 1.0, 0.0); + Box(1.0, 0.5, 1.0, solid); + glTranslatef(0.0, -0.45, 0.0); +#ifdef LIGHT + SetMaterial(mat_specular2, mat_ambient2, mat_diffuse2, mat_shininess2); +#endif + glColor3f(0.5, 0.5, 0.5); +#ifdef SPHERE + joints = gluNewQuadric(); + if(!solid)gluQuadricDrawStyle(joints, GLU_LINE); + gluSphere(joints,0.2, 16, 16); + free(joints); +#endif + if (leg) + glRotatef((GLfloat) heel1, 1.0, 0.0, 0.0); + else + glRotatef((GLfloat) heel2, 1.0, 0.0, 0.0); + /* glTranslatef(0.0, -0.2, 0.0); */ + glTranslatef(0.0, -1.7, 0.0); +#ifdef LIGHT + SetMaterial(mat_specular, mat_ambient, mat_diffuse, mat_shininess); +#endif + glColor3f(1.0, 1.0, 0.0); + Box(0.25, 3.0, 0.25, solid); + glTranslatef(0.0, -1.7, 0.0); +#ifdef LIGHT + SetMaterial(mat_specular2, mat_ambient2, mat_diffuse2, mat_shininess2); +#endif + glColor3f(0.5, 0.5, 0.5); +#ifdef SPHERE + joints = gluNewQuadric(); + if(!solid)gluQuadricDrawStyle(joints, GLU_LINE); + gluSphere(joints, 0.2, 16, 16); +#endif + if (leg) + glRotatef((GLfloat) - heel1, 1.0, 0.0, 0.0); + else + glRotatef((GLfloat) - heel2, 1.0, 0.0, 0.0); + glTranslatef(0.0, -0.45, 0.0); +#ifdef LIGHT + SetMaterial(mat_specular, mat_ambient, mat_diffuse, mat_shininess); +#endif + glColor3f(1.0, 1.0, 0.0); + Box(1.0, 0.5, 1.0, solid); + if (!k && !l) { + int j; + + glTranslatef(-0.4, -0.8, 0.5); + if (leg) + glRotatef((GLfloat) ankle1, 1.0, 0.0, 0.0); + else + glRotatef((GLfloat) ankle2, 1.0, 0.0, 0.0); + glRotatef(90.0, 0.0, 1.0, 0.0); + if (!solid) + gluQuadricDrawStyle(ankle, GLU_LINE); + gluCylinder(ankle, 0.8, 0.8, 1.8, 16, 10); + for (j = 0; j < 2; j++) { + ankle_face[j] = gluNewQuadric(); + if (!solid) + gluQuadricDrawStyle(ankle_face[j], GLU_LINE); + if (j) { + glScalef(-1.0, 1.0, 1.0); + glTranslatef(0.0, 0.0, 1.8); + } + gluDisk(ankle_face[j], 0.0, 0.8, 16, 10); + if (j) + glTranslatef(0.0, 0.0, -1.8); + } + glScalef(-1.0, 1.0, 1.0); + glRotatef(-90.0, 0.0, 1.0, 0.0); + glTranslatef(0.95, -0.8, 0.0); + glCallList(SOLID_MECH_FOOT); + } + glPopMatrix(); + } + } +} + +void +RocketPod(char solid) +{ + + int i, j, k = 0; + GLUquadricObj *rocket[6]; + GLUquadricObj *rocket1[6]; + + glNewList(SOLID_MECH_ROCKET, GL_COMPILE); +#ifdef LIGHT + SetMaterial(mat_specular2, mat_ambient2, mat_diffuse2, mat_shininess2); +#endif + glColor3f(0.5, 0.5, 0.5); + glScalef(0.4, 0.4, 0.4); + glRotatef(45.0, 0.0, 0.0, 1.0); + glTranslatef(1.0, 0.0, 0.0); + Box(2.0, 0.5, 3.0, solid); + glTranslatef(1.0, 0.0, 0.0); + glRotatef(45.0, 0.0, 0.0, 1.0); + glTranslatef(0.5, 0.0, 0.0); + Box(1.2, 0.5, 3.0, solid); + glTranslatef(2.1, 0.0, 0.0); + glRotatef(-90.0, 0.0, 0.0, 1.0); +#ifdef LIGHT + SetMaterial(mat_specular, mat_ambient, mat_diffuse, mat_shininess); +#endif + glColor3f(1.0, 1.0, 0.0); + Box(2.0, 3.0, 4.0, solid); + glTranslatef(-0.5, -1.0, 1.3); + for (i = 0; i < 2; i++) { + for (j = 0; j < 3; j++) { + rocket[k] = gluNewQuadric(); + rocket1[k] = gluNewQuadric(); + if (!solid) { + gluQuadricDrawStyle(rocket[k], GLU_LINE); + gluQuadricDrawStyle(rocket1[k], GLU_LINE); + } + glTranslatef(i, j, 0.6); +#ifdef LIGHT + SetMaterial(mat_specular3, mat_ambient3, mat_diffuse3, mat_shininess3); +#endif + glColor3f(1.0, 1.0, 1.0); + gluCylinder(rocket[k], 0.4, 0.4, 0.3, 16, 10); + glTranslatef(0.0, 0.0, 0.3); +#ifdef LIGHT + SetMaterial(mat_specular4, mat_ambient4, mat_diffuse4, mat_shininess4); +#endif + glColor3f(0.0, 1.0, 0.0); + gluCylinder(rocket1[k], 0.4, 0.0, 0.5, 16, 10); + k++; + glTranslatef(-i, -j, -0.9); + } + } + glEndList(); +} + +void +Enviro(char solid) +{ + + int i, j; + + glNewList(SOLID_ENVIRO, GL_COMPILE); + SetMaterial(mat_specular4, mat_ambient4, mat_diffuse4, mat_shininess4); + glColor3f(0.0, 1.0, 0.0); + Box(20.0, 0.5, 30.0, solid); + + SetMaterial(mat_specular4, mat_ambient3, mat_diffuse2, mat_shininess); + glColor3f(0.6, 0.6, 0.6); + glTranslatef(0.0, 0.0, -10.0); + for (j = 0; j < 6; j++) { + for (i = 0; i < 2; i++) { + if (i) + glScalef(-1.0, 1.0, 1.0); + glTranslatef(10.0, 4.0, 0.0); + Box(4.0, 8.0, 2.0, solid); + glTranslatef(0.0, -1.0, -3.0); + Box(4.0, 6.0, 2.0, solid); + glTranslatef(-10.0, -3.0, 3.0); + } + glScalef(-1.0, 1.0, 1.0); + glTranslatef(0.0, 0.0, 5.0); + } + + glEndList(); +} + +void +Toggle(void) +{ + if (solid_part) + solid_part = 0; + else + solid_part = 1; +} + +void +disable(void) +{ + glDisable(GL_LIGHTING); + glDisable(GL_DEPTH_TEST); + glDisable(GL_NORMALIZE); + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); +} + +void +lighting(void) +{ + + GLfloat position[] = + {0.0, 0.0, 2.0, 1.0}; + +#ifdef MOVE_LIGHT + glRotatef((GLfloat) lightturn1, 1.0, 0.0, 0.0); + glRotatef((GLfloat) lightturn, 0.0, 1.0, 0.0); + glRotatef(0.0, 1.0, 0.0, 0.0); +#endif + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + glEnable(GL_NORMALIZE); + /* glEnable(GL_FLAT); */ + /* glDepthFunc(GL_LESS); */ + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + + glLightfv(GL_LIGHT0, GL_POSITION, position); + glLightf(GL_LIGHT0, GL_SPOT_CUTOFF, 80.0); + + glTranslatef(0.0, 0.0, 2.0); + glDisable(GL_LIGHTING); + Box(0.1, 0.1, 0.1, 0); + glEnable(GL_LIGHTING); + /* glEnable(GL_CULL_FACE); */ +} + +void +DrawMech(void) +{ + int i, j; + + glScalef(0.5, 0.5, 0.5); + glPushMatrix(); + glTranslatef(0.0, -0.75, 0.0); + glRotatef((GLfloat) tilt, 1.0, 0.0, 0.0); + + glRotatef(90.0, 1.0, 0.0, 0.0); +#ifdef HIP + glCallList(SOLID_MECH_HIP); +#endif + glRotatef(-90.0, 1.0, 0.0, 0.0); + + glTranslatef(0.0, 0.75, 0.0); + glPushMatrix(); + glRotatef((GLfloat) pivot, 0.0, 1.0, 0.0); + glPushMatrix(); +#ifdef TORSO + glCallList(SOLID_MECH_TORSO); +#endif + glPopMatrix(); + glPushMatrix(); + glTranslatef(0.5, 0.5, 0.0); +#ifdef ROCKET_POD + glCallList(SOLID_MECH_ROCKET); +#endif + glPopMatrix(); + for (i = 0; i < 2; i++) { + glPushMatrix(); + if (i) + glScalef(-1.0, 1.0, 1.0); + glTranslatef(1.5, 0.0, 0.0); +#ifdef SHOULDER + glCallList(SOLID_MECH_SHOULDER); +#endif + glTranslatef(0.9, 0.0, 0.0); + if (i) { + glRotatef((GLfloat) lat1, 0.0, 0.0, 1.0); + glRotatef((GLfloat) shoulder1, 1.0, 0.0, 0.0); + glRotatef((GLfloat) shoulder3, 0.0, 1.0, 0.0); + } else { + glRotatef((GLfloat) lat2, 0.0, 0.0, 1.0); + glRotatef((GLfloat) shoulder2, 1.0, 0.0, 0.0); + glRotatef((GLfloat) shoulder4, 0.0, 1.0, 0.0); + } + glTranslatef(0.0, -1.4, 0.0); +#ifdef UPPER_ARM + glCallList(SOLID_MECH_UPPER_ARM); +#endif + glTranslatef(0.0, -2.9, 0.0); + if (i) + glRotatef((GLfloat) elbow1, 1.0, 0.0, 0.0); + else + glRotatef((GLfloat) elbow2, 1.0, 0.0, 0.0); + glTranslatef(0.0, -0.9, -0.2); +#ifdef LOWER_ARM + glCallList(SOLID_MECH_FOREARM); + glPushMatrix(); + glTranslatef(0.0, 0.0, 2.0); + glRotatef((GLfloat) fire, 0.0, 0.0, 1.0); + glCallList(SOLID_MECH_VULCAN); + glPopMatrix(); +#endif + glPopMatrix(); + } + glPopMatrix(); + + glPopMatrix(); + + for (j = 0; j < 2; j++) { + glPushMatrix(); + if (j) { + glScalef(-0.5, 0.5, 0.5); + leg = 1; + } else { + glScalef(0.5, 0.5, 0.5); + leg = 0; + } + glTranslatef(2.0, -1.5, 0.0); + if (j) { + glRotatef((GLfloat) hip11, 1.0, 0.0, 0.0); + glRotatef((GLfloat) hip12, 0.0, 0.0, 1.0); + } else { + glRotatef((GLfloat) hip21, 1.0, 0.0, 0.0); + glRotatef((GLfloat) hip22, 0.0, 0.0, 1.0); + } + glTranslatef(0.0, 0.3, 0.0); +#ifdef UPPER_LEG + glPushMatrix(); + glCallList(SOLID_MECH_UPPER_LEG); + glPopMatrix(); +#endif + glTranslatef(0.0, -8.3, -0.4); + if (j) + glRotatef((GLfloat) - hip12, 0.0, 0.0, 1.0); + else + glRotatef((GLfloat) - hip22, 0.0, 0.0, 1.0); + glTranslatef(-0.5, -0.85, -0.5); +#ifdef LOWER_LEG + LowerLeg(1); +#endif + glPopMatrix(); + } +} + +void +display(void) +{ + glClearColor(0.0, 0.0, 0.0, 0.0); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glEnable(GL_DEPTH_TEST); + + glPushMatrix(); + glRotatef((GLfloat) turn, 0.0, 1.0, 0.0); + glRotatef((GLfloat) turn1, 1.0, 0.0, 0.0); +#ifdef LIGHT + if (solid_part) { + glPushMatrix(); + lighting(); + glPopMatrix(); + } else + disable(); +#endif +#ifdef DRAW_MECH + glPushMatrix(); + glTranslatef(0.0, elevation, 0.0); + DrawMech(); + glPopMatrix(); +#endif +#ifdef DRAW_ENVIRO + glPushMatrix(); + if (distance >= 20.136) + distance = 0.0; + glTranslatef(0.0, -5.0, -distance); + glCallList(SOLID_ENVIRO); + glTranslatef(0.0, 0.0, 10.0); + glCallList(SOLID_ENVIRO); + glPopMatrix(); +#endif + glPopMatrix(); + glFlush(); + tkSwapBuffers(); +} + +void +init(void) +{ + char i = 1; + +#ifdef LIGHT + SetMaterial(mat_specular2, mat_ambient2, mat_diffuse2, mat_shininess2); +#endif + glEnable(GL_DEPTH_TEST); + MechTorso(i); + MechHip(i); + Shoulder(i); + RocketPod(i); + UpperArm(i); + ForeArm(i); + UpperLeg(i); + Foot(i); + VulcanGun(i); + Enviro(i); +} + +void +reshape(int w, int h) +{ + glViewport(0, 0, w, h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(65.0, (GLfloat) w / (GLfloat) h, 1.0, 20.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.0, 1.2, -5.5); /* viewing transform */ +} + +#ifdef ANIMATION +void +animation_walk(void) +{ + float angle; + static int step; + + if (step == 0 || step == 2) { + /* for(frame=3.0; frame<=21.0; frame=frame+3.0){ */ + if (frame >= 0.0 && frame <= 21.0) { + if (frame == 0.0) + frame = 3.0; + angle = (180 / PI) * (acos(((cos((PI / 180) * frame) * 2.043) + 1.1625) / 3.2059)); + if (frame > 0) { + elevation = -(3.2055 - (cos((PI / 180) * angle) * 3.2055)); + } else + elevation = 0.0; + if (step == 0) { + hip11 = -(frame * 1.7); + if (1.7 * frame > 15) + heel1 = frame * 1.7; + heel2 = 0; + ankle1 = frame * 1.7; + if (frame > 0) + hip21 = angle; + else + hip21 = 0; + ankle2 = -hip21; + shoulder1 = frame * 1.5; + shoulder2 = -frame * 1.5; + elbow1 = frame; + elbow2 = -frame; + } else { + hip21 = -(frame * 1.7); + if (1.7 * frame > 15) + heel2 = frame * 1.7; + heel1 = 0; + ankle2 = frame * 1.7; + if (frame > 0) + hip11 = angle; + else + hip11 = 0; + ankle1 = -hip11; + shoulder1 = -frame * 1.5; + shoulder2 = frame * 1.5; + elbow1 = -frame; + elbow2 = frame; + } + if (frame == 21) + step++; + if (frame < 21) + frame = frame + 3.0; + } + } + if (step == 1 || step == 3) { + /* for(x=21.0; x>=0.0; x=x-3.0){ */ + if (frame <= 21.0 && frame >= 0.0) { + angle = (180 / PI) * (acos(((cos((PI / 180) * frame) * 2.043) + 1.1625) / 3.2029)); + if (frame > 0) + elevation = -(3.2055 - (cos((PI / 180) * angle) * 3.2055)); + else + elevation = 0.0; + if (step == 1) { + elbow2 = hip11 = -frame; + elbow1 = heel1 = frame; + heel2 = 15; + ankle1 = frame; + if (frame > 0) + hip21 = angle; + else + hip21 = 0; + ankle2 = -hip21; + shoulder1 = 1.5 * frame; + shoulder2 = -frame * 1.5; + } else { + elbow1 = hip21 = -frame; + elbow2 = heel2 = frame; + heel1 = 15; + ankle2 = frame; + if (frame > 0) + hip11 = angle; + else + hip11 = 0; + ankle1 = -hip11; + shoulder1 = -frame * 1.5; + shoulder2 = frame * 1.5; + } + if (frame == 0.0) + step++; + if (frame > 0) + frame = frame - 3.0; + } + } + if (step == 4) + step = 0; + distance += 0.1678; +} + +void +animation(void) +{ + animation_walk(); +} + +#endif + +GLenum key(int key, GLenum mask) +{ + + int i = 0; + + switch (key) { + /* start arm control functions */ + case 'q':{ + shoulder2Subtract(); + i++; + } + break; + case 'a':{ + shoulder2Add(); + i++; + } + break; + case 'w':{ + shoulder1Subtract(); + i++; + } + break; + case 's':{ + shoulder1Add(); + i++; + } + break; + case '2':{ + shoulder3Add(); + i++; + } + break; + case '1':{ + shoulder4Add(); + i++; + } + break; + case '4':{ + shoulder3Subtract(); + i++; + } + break; + case '3':{ + shoulder4Subtract(); + i++; + } + break; + + case 'z':{ + lat2Raise(); + i++; + } + break; + case 'Z':{ + lat2Lower(); + i++; + } + break; + case 'x':{ + lat1Raise(); + i++; + } + break; + case 'X':{ + lat1Lower(); + i++; + } + break; + + case 'A':{ + elbow2Add(); + i++; + } + break; + case 'Q':{ + elbow2Subtract(); + i++; + } + break; + case 'S':{ + elbow1Add(); + i++; + } + break; + case 'W':{ + elbow1Subtract(); + i++; + } + break; + /* end of arm control functions */ + + /* start of torso control functions */ + case 'd':{ + RotateAdd(); + i++; + } + break; + case 'g':{ + RotateSubtract(); + i++; + } + break; + case 'r':{ + MechTiltAdd(); + i++; + } + break; + case 'f':{ + MechTiltSubtract(); + i++; + } + break; + /* end of torso control functions */ + + /* start of leg control functions */ + case 'h':{ + RaiseLeg2Forward(); + i++; + } + break; + case 'y':{ + LowerLeg2Backwards(); + i++; + } + break; + case 'Y':{ + RaiseLeg2Outwards(); + i++; + } + break; + case 'H':{ + LowerLeg2Inwards(); + i++; + } + break; + + case 'j':{ + RaiseLeg1Forward(); + i++; + } + break; + case 'u':{ + LowerLeg1Backwards(); + i++; + } + break; + case 'U':{ + RaiseLeg1Outwards(); + i++; + } + break; + case 'J':{ + LowerLeg1Inwards(); + i++; + } + break; + + case 'N':{ + Heel2Add(); + i++; + } + break; + case 'n':{ + Heel2Subtract(); + i++; + } + break; + case 'M':{ + Heel1Add(); + i++; + } + break; + case 'm':{ + Heel1Subtract(); + i++; + } + break; + + case 'k':{ + Ankle2Add(); + i++; + } + break; + case 'K':{ + Ankle2Subtract(); + i++; + } + break; + case 'l':{ + Ankle1Add(); + i++; + } + break; + case 'L':{ + Ankle1Subtract(); + i++; + } + break; + /* end of leg control functions */ + + /* start of light source position functions */ + case 'p':{ + LightTurnRight(); + i++; + } + break; + case 'i':{ + LightTurnLeft(); + i++; + } + break; + case 'o':{ + LightForwards(); + i++; + } + break; + case '9':{ + LightBackwards(); + i++; + } + break; + /* end of light source position functions */ + + /* start of misc functions */ + case 't': + Toggle(); + break; + + case KEY_LEFT: + TurnLeft(); + break; + case KEY_RIGHT: + TurnRight(); + break; + case KEY_UP: + TurnBackwards(); + break; + case KEY_DOWN: + TurnForwards(); + break; + + case ' ': + FireCannon(); + } + return 0; +} + +void printHelp(void) +{ + printf("at the shoulders:"); + printf("forward : q,w"); + printf("backwards : a,s"); + printf("outwards : z,x"); + printf("inwards : Z,X"); +#if 0 + glut_menu[6] = glutCreateMenu(null_select); + printf("upwards : Q,W\n"); + printf("downwards : A,S\n"); + printf("outwards : 1,2\n"); + printf("inwards : 3,4\n"); + + glut_menu[1] = glutCreateMenu(null_select); + printf(" : Page_up\n"); + + glut_menu[8] = glutCreateMenu(null_select); + printf("forward : y,u\n"); + printf("backwards : h.j\n"); + printf("outwards : Y,U\n"); + printf("inwards : H,J\n"); + + glut_menu[9] = glutCreateMenu(null_select); + printf("forward : n,m\n"); + printf("backwards : N,M\n"); + + glut_menu[9] = glutCreateMenu(null_select); + printf("forward : n,m\n"); + printf("backwards : N,M\n"); + + glut_menu[10] = glutCreateMenu(null_select); + printf("toes up : K,L\n"); + printf("toes down : k,l\n"); + + glut_menu[11] = glutCreateMenu(null_select); + printf("right : right arrow\n"); + printf("left : left arrow\n"); + printf("down : up arrow\n"); + printf("up : down arrow\n"); + + glut_menu[12] = glutCreateMenu(null_select); + printf("right : p\n"); + printf("left : i\n"); + printf("up : 9\n"); + printf("down : o\n"); + + glut_menu[4] = glutCreateMenu(NULL); + glutAddSubMenu("at the elbows?", glut_menu[6]); + + glut_menu[7] = glutCreateMenu(NULL); + glutAddSubMenu("at the hip? ", glut_menu[8]); + glutAddSubMenu("at the knees?", glut_menu[9]); + glutAddSubMenu("at the ankles? ", glut_menu[10]); + + printf("turn left : d\n"); + printf("turn right : g\n"); + + glut_menu[3] = glutCreateMenu(null_select); + printf("tilt backwards : f\n"); + printf("tilt forwards : r\n"); + + glut_menu[0] = glutCreateMenu(NULL); + glutAddSubMenu("move the arms.. ", glut_menu[4]); + glutAddSubMenu("fire the vulcan guns?", glut_menu[1]); + glutAddSubMenu("move the legs.. ", glut_menu[7]); + glutAddSubMenu("move the torso?", glut_menu[2]); + glutAddSubMenu("move the hip?", glut_menu[3]); + glutAddSubMenu("rotate the scene..", glut_menu[11]); +#ifdef MOVE_LIGHT + glutAddSubMenu("rotate the light source..", glut_menu[12]); +#endif + + glutCreateMenu(menu_select); +#ifdef ANIMATION + printf("Start Walk", 1); + printf("Stop Walk", 2); +#endif + printf("Toggle Wireframe", 3); + glutAddSubMenu("How do I ..", glut_menu[0]); + printfy("Quit", 4); + glutAttachMenu(GLUT_LEFT_BUTTON); + glutAttachMenu(GLUT_RIGHT_BUTTON); +#endif +} + +void idle( void ) +{ + /* animate the mech */ + + animation(); + + /* draw the Mech */ + + display(); +} + +/* #define PROFILE */ + +#ifdef PROFILE +extern int count_triangles; +#endif + +// #define LINUX_TEST_FLOAT + +#ifdef LINUX_TEST_FLOAT +#include +#endif + +int +main(int argc, char **argv) +{ +#ifdef LINUX_TEST_FLOAT + /* for debuging floating point errors under Linux */ + __setfpucw ( 0x1372 ); +#endif + + Toggle(); + + return ui_loop(argc, argv, "mech"); +} diff --git a/programs/develop/libraries/TinyGL/examples/nanox.c b/programs/develop/libraries/TinyGL/examples/nanox.c new file mode 100644 index 0000000000..14e5d4f1c7 --- /dev/null +++ b/programs/develop/libraries/TinyGL/examples/nanox.c @@ -0,0 +1,113 @@ +/* + * Demonstration program for Nano-X graphics. + */ +#include +#include +#include +#define MWINCLUDECOLORS +#include +#include +#include +#include "ui.h" + +static GR_WINDOW_ID w1; /* id for large window */ +static GR_GC_ID gc1; /* graphics context for text */ + +void errorcatcher(); /* routine to handle errors */ + +void tkSwapBuffers(void) +{ + nglXSwapBuffers(w1); +} + +int +ui_loop(int argc,char **argv, const char *name) +{ + GR_EVENT event; /* current event */ + GR_IMAGE_ID id = 0; + NGLXContext cx; + int width, height, k; + + if (GrOpen() < 0) { + fprintf(stderr, "cannot open graphics\n"); + exit(1); + } + + width = 400; + height = 300; + + GrSetErrorHandler(errorcatcher); + + w1 = GrNewWindow(GR_ROOT_WINDOW_ID, 10, 10, width, height, 4, BLACK, WHITE); + + GrSelectEvents(w1, GR_EVENT_MASK_CLOSE_REQ|GR_EVENT_MASK_EXPOSURE|GR_EVENT_MASK_KEY_DOWN); + + GrMapWindow(w1); + + gc1 = GrNewGC(); + + GrSetGCForeground(gc1, WHITE); + + cx = nglXCreateContext(NULL, 0); + nglXMakeCurrent(w1, cx); + + init(); + reshape(width, height); + + while (1) { + GrCheckNextEvent(&event); + switch(event.type) { + case GR_EVENT_TYPE_CLOSE_REQ: + GrFreeImage(id); + GrClose(); + exit(0); + case GR_EVENT_TYPE_EXPOSURE: + break; + case GR_EVENT_TYPE_KEY_DOWN: + { + GR_EVENT_KEYSTROKE *kp = &event.keystroke; + /* XXX: nanoX special keys are totally bugged ! */ + switch(kp->ch) { + case 81: + k = KEY_LEFT; + break; + case 83: + k = KEY_RIGHT; + break; + case 82: + k = KEY_UP; + break; + case 84: + k = KEY_DOWN; + break; + default: + k = kp->ch; + break; + } + key(k, 0); + } + break; + default: + idle(); + break; + } + } + + return 0; +} + + +/* + * Here on an unrecoverable error. + */ +void +errorcatcher(code, name, id) + GR_ERROR code; /* error code */ + GR_FUNC_NAME name; /* function name which failed */ + GR_ID id; /* resource id */ +{ + GrClose(); + fprintf(stderr, "DEMO ERROR: code %d, function %s, resource id %d\n", + code, name, id); + exit(1); +} diff --git a/programs/develop/libraries/TinyGL/examples/spin.c b/programs/develop/libraries/TinyGL/examples/spin.c new file mode 100644 index 0000000000..339bf00328 --- /dev/null +++ b/programs/develop/libraries/TinyGL/examples/spin.c @@ -0,0 +1,160 @@ +/* spin.c */ + + +/* + * Spinning box. This program is in the public domain. + * + * Brian Paul + */ + + +#include +#include + +#include +#include +#include "ui.h" + + + + +static GLfloat Xrot, Xstep; +static GLfloat Yrot, Ystep; +static GLfloat Zrot, Zstep; +static GLfloat Step = 5.0; +static GLfloat Scale = 1.0; +static GLuint Object; + + + + +static GLuint make_object( void ) +{ + GLuint list; + + list = glGenLists( 1 ); + + glNewList( list, GL_COMPILE ); + + glBegin( GL_LINE_LOOP ); + glColor3f( 1.0, 1.0, 1.0 ); + glVertex3f( 1.0, 0.5, -0.4 ); + glColor3f( 1.0, 0.0, 0.0 ); + glVertex3f( 1.0, -0.5, -0.4 ); + glColor3f( 0.0, 1.0, 0.0 ); + glVertex3f( -1.0, -0.5, -0.4 ); + glColor3f( 0.0, 0.0, 1.0 ); + glVertex3f( -1.0, 0.5, -0.4 ); + glEnd(); + + glColor3f( 1.0, 1.0, 1.0 ); + + glBegin( GL_LINE_LOOP ); + glVertex3f( 1.0, 0.5, 0.4 ); + glVertex3f( 1.0, -0.5, 0.4 ); + glVertex3f( -1.0, -0.5, 0.4 ); + glVertex3f( -1.0, 0.5, 0.4 ); + glEnd(); + + glBegin( GL_LINES ); + glVertex3f( 1.0, 0.5, -0.4 ); glVertex3f( 1.0, 0.5, 0.4 ); + glVertex3f( 1.0, -0.5, -0.4 ); glVertex3f( 1.0, -0.5, 0.4 ); + glVertex3f( -1.0, -0.5, -0.4 ); glVertex3f( -1.0, -0.5, 0.4 ); + glVertex3f( -1.0, 0.5, -0.4 ); glVertex3f( -1.0, 0.5, 0.4 ); + glEnd(); + + + glEndList(); + + return list; +} + + + +void reshape( int width, int height ) +{ + glViewport(0, 0, (GLint)width, (GLint)height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 15.0 ); + glMatrixMode(GL_MODELVIEW); +} + + +GLenum key(int k, GLenum mask) +{ + switch (k) { + case KEY_ESCAPE: + exit(0); + } + return GL_FALSE; +} + + +void draw( void ) +{ + glClear( GL_COLOR_BUFFER_BIT ); + + glPushMatrix(); + + glTranslatef( 0.0, 0.0, -10.0 ); + glScalef( Scale, Scale, Scale ); + if (Xstep) { + glRotatef( Xrot, 1.0, 0.0, 0.0 ); + } + else if (Ystep) { + glRotatef( Yrot, 0.0, 1.0, 0.0 ); + } + else { + glRotatef( Zrot, 0.0, 0.0, 1.0 ); + } + + glCallList( Object ); + + glPopMatrix(); + + glFlush(); + tkSwapBuffers(); +} + + +void idle( void ) +{ + Xrot += Xstep; + Yrot += Ystep; + Zrot += Zstep; + + if (Xrot>=360.0) { + Xrot = Xstep = 0.0; + Ystep = Step; + } + else if (Yrot>=360.0) { + Yrot = Ystep = 0.0; + Zstep = Step; + } + else if (Zrot>=360.0) { + Zrot = Zstep = 0.0; + Xstep = Step; + } + draw(); +} + +void init(void) +{ + Object = make_object(); + glCullFace( GL_BACK ); +/* glEnable( GL_CULL_FACE );*/ + glDisable( GL_DITHER ); + glShadeModel( GL_FLAT ); +/* glEnable( GL_DEPTH_TEST ); */ + + Xrot = Yrot = Zrot = 0.0; + Xstep = Step; + Ystep = Zstep = 0.0; +} + + +int main( int argc, char *argv[] ) +{ + return ui_loop(argc, argv, "spin"); +} diff --git a/programs/develop/libraries/TinyGL/examples/texobj.c b/programs/develop/libraries/TinyGL/examples/texobj.c new file mode 100644 index 0000000000..913d35aa20 --- /dev/null +++ b/programs/develop/libraries/TinyGL/examples/texobj.c @@ -0,0 +1,193 @@ +/* + * Example of using the 1.1 texture object functions. + * Also, this demo utilizes Mesa's fast texture map path. + * + * Brian Paul June 1996 + */ + +#include +#include +#include +#include + +#include +#include +#include "ui.h" + +static GLuint TexObj[2]; +static GLfloat Angle = 0.0f; + +static int cnt=0,v=0; + +void +draw(void) +{ + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + + glColor3f(1.0, 1.0, 1.0); + + /* draw first polygon */ + glPushMatrix(); + glTranslatef(-1.0, 0.0, 0.0); + glRotatef(Angle, 0.0, 0.0, 1.0); + glBindTexture(GL_TEXTURE_2D, TexObj[v]); + + glEnable(GL_TEXTURE_2D); + glBegin(GL_QUADS); + glTexCoord2f(0.0, 0.0); + glVertex2f(-1.0, -1.0); + glTexCoord2f(1.0, 0.0); + glVertex2f(1.0, -1.0); + glTexCoord2f(1.0, 1.0); + glVertex2f(1.0, 1.0); + glTexCoord2f(0.0, 1.0); + glVertex2f(-1.0, 1.0); + glEnd(); + glDisable(GL_TEXTURE_2D); + glPopMatrix(); + + /* draw second polygon */ + glPushMatrix(); + glTranslatef(1.0, 0.0, 0.0); + glRotatef(Angle - 90.0, 0.0, 1.0, 0.0); + + glBindTexture(GL_TEXTURE_2D, TexObj[1-v]); + + glEnable(GL_TEXTURE_2D); + glBegin(GL_QUADS); + glTexCoord2f(0.0, 0.0); + glVertex2f(-1.0, -1.0); + glTexCoord2f(1.0, 0.0); + glVertex2f(1.0, -1.0); + glTexCoord2f(1.0, 1.0); + glVertex2f(1.0, 1.0); + glTexCoord2f(0.0, 1.0); + glVertex2f(-1.0, 1.0); + glEnd(); + glDisable(GL_TEXTURE_2D); + + glPopMatrix(); + + tkSwapBuffers(); +} + + +/* new window size or exposure */ +void +reshape(int width, int height) +{ + glViewport(0, 0, (GLint) width, (GLint) height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + /* glOrtho( -3.0, 3.0, -3.0, 3.0, -10.0, 10.0 ); */ + glFrustum(-2.0, 2.0, -2.0, 2.0, 6.0, 20.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.0, 0.0, -8.0); +} + + +void bind_texture(int texobj,int image) +{ + static int width = 8, height = 8; + static int color[2][3]={ + {255,0,0}, + {0,255,0}, + }; + GLubyte tex[64][3]; + static GLubyte texchar[2][8*8] = { + { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 0, + 0, 0, 0, 1, 1, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 0, + 0, 0, 0, 1, 1, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0}, + { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 2, 2, 0, 0, 0, + 0, 0, 2, 0, 0, 2, 0, 0, + 0, 0, 0, 0, 0, 2, 0, 0, + 0, 0, 0, 0, 2, 0, 0, 0, + 0, 0, 0, 2, 0, 0, 0, 0, + 0, 0, 2, 2, 2, 2, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0}}; + + int i,j; + + glBindTexture(GL_TEXTURE_2D, texobj); + + /* red on white */ + for (i = 0; i < height; i++) { + for (j = 0; j < width; j++) { + int p = i * width + j; + if (texchar[image][(height - i - 1) * width + j]) { + tex[p][0] = color[image][0]; + tex[p][1] = color[image][1]; + tex[p][2] = color[image][2]; + } else { + tex[p][0] = 255; + tex[p][1] = 255; + tex[p][2] = 255; + } + } + } + glTexImage2D(GL_TEXTURE_2D, 0, 3, width, height, 0, + GL_RGB, GL_UNSIGNED_BYTE, tex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + /* end of texture object */ +} + + + +void +init(void) +{ + glEnable(GL_DEPTH_TEST); + + /* Setup texturing */ + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); + glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST); + + /* generate texture object IDs */ + glGenTextures(2, TexObj); + bind_texture(TexObj[0],0); + bind_texture(TexObj[1],1); + +} + +void +idle(void) +{ + + Angle += 2.0; + + if (++cnt==5) { + cnt=0; + v=!v; + } + draw(); +} + +/* change view angle, exit upon ESC */ +GLenum key(int k, GLenum mask) +{ + switch (k) { + case 'q': + case KEY_ESCAPE: + exit(0); + } + return GL_FALSE; +} + +int main(int argc, char **argv) +{ + return ui_loop(argc, argv, "texobj"); +} + + diff --git a/programs/develop/libraries/TinyGL/examples/ui.h b/programs/develop/libraries/TinyGL/examples/ui.h new file mode 100644 index 0000000000..8814566eab --- /dev/null +++ b/programs/develop/libraries/TinyGL/examples/ui.h @@ -0,0 +1,17 @@ +/* + * tk like ui + */ +void draw( void ); +void idle( void ); +GLenum key(int k, GLenum mask); +void reshape( int width, int height ); +void init( void ); +int ui_loop(int argc, char **argv, const char *name); +void tkSwapBuffers(void); + +#define KEY_UP 0xe000 +#define KEY_DOWN 0xe001 +#define KEY_LEFT 0xe002 +#define KEY_RIGHT 0xe003 +#define KEY_ESCAPE 0xe004 + diff --git a/programs/develop/libraries/TinyGL/include/GL/gl.h b/programs/develop/libraries/TinyGL/include/GL/gl.h new file mode 100644 index 0000000000..9773624af8 --- /dev/null +++ b/programs/develop/libraries/TinyGL/include/GL/gl.h @@ -0,0 +1,838 @@ +/* + * The following constants come from Mesa + */ +#ifndef GL_H +#define GL_H + +#define GL_VERSION_1_1 1 + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + /* Boolean values */ + GL_FALSE = 0, + GL_TRUE = 1, + + /* Data types */ + GL_BYTE = 0x1400, + GL_UNSIGNED_BYTE = 0x1401, + GL_SHORT = 0x1402, + GL_UNSIGNED_SHORT = 0x1403, + GL_INT = 0x1404, + GL_UNSIGNED_INT = 0x1405, + GL_FLOAT = 0x1406, + GL_DOUBLE = 0x140A, + GL_2_BYTES = 0x1407, + GL_3_BYTES = 0x1408, + GL_4_BYTES = 0x1409, + + /* Primitives */ + GL_LINES = 0x0001, + GL_POINTS = 0x0000, + GL_LINE_STRIP = 0x0003, + GL_LINE_LOOP = 0x0002, + GL_TRIANGLES = 0x0004, + GL_TRIANGLE_STRIP = 0x0005, + GL_TRIANGLE_FAN = 0x0006, + GL_QUADS = 0x0007, + GL_QUAD_STRIP = 0x0008, + GL_POLYGON = 0x0009, + GL_EDGE_FLAG = 0x0B43, + + /* Vertex Arrays */ + GL_VERTEX_ARRAY = 0x8074, + GL_NORMAL_ARRAY = 0x8075, + GL_COLOR_ARRAY = 0x8076, + GL_INDEX_ARRAY = 0x8077, + GL_TEXTURE_COORD_ARRAY = 0x8078, + GL_EDGE_FLAG_ARRAY = 0x8079, + GL_VERTEX_ARRAY_SIZE = 0x807A, + GL_VERTEX_ARRAY_TYPE = 0x807B, + GL_VERTEX_ARRAY_STRIDE = 0x807C, + GL_VERTEX_ARRAY_COUNT = 0x807D, + GL_NORMAL_ARRAY_TYPE = 0x807E, + GL_NORMAL_ARRAY_STRIDE = 0x807F, + GL_NORMAL_ARRAY_COUNT = 0x8080, + GL_COLOR_ARRAY_SIZE = 0x8081, + GL_COLOR_ARRAY_TYPE = 0x8082, + GL_COLOR_ARRAY_STRIDE = 0x8083, + GL_COLOR_ARRAY_COUNT = 0x8084, + GL_INDEX_ARRAY_TYPE = 0x8085, + GL_INDEX_ARRAY_STRIDE = 0x8086, + GL_INDEX_ARRAY_COUNT = 0x8087, + GL_TEXTURE_COORD_ARRAY_SIZE = 0x8088, + GL_TEXTURE_COORD_ARRAY_TYPE = 0x8089, + GL_TEXTURE_COORD_ARRAY_STRIDE = 0x808A, + GL_TEXTURE_COORD_ARRAY_COUNT = 0x808B, + GL_EDGE_FLAG_ARRAY_STRIDE = 0x808C, + GL_EDGE_FLAG_ARRAY_COUNT = 0x808D, + GL_VERTEX_ARRAY_POINTER = 0x808E, + GL_NORMAL_ARRAY_POINTER = 0x808F, + GL_COLOR_ARRAY_POINTER = 0x8090, + GL_INDEX_ARRAY_POINTER = 0x8091, + GL_TEXTURE_COORD_ARRAY_POINTER = 0x8092, + GL_EDGE_FLAG_ARRAY_POINTER = 0x8093, + GL_V2F = 0x2A20, + GL_V3F = 0x2A21, + GL_C4UB_V2F = 0x2A22, + GL_C4UB_V3F = 0x2A23, + GL_C3F_V3F = 0x2A24, + GL_N3F_V3F = 0x2A25, + GL_C4F_N3F_V3F = 0x2A26, + GL_T2F_V3F = 0x2A27, + GL_T4F_V4F = 0x2A28, + GL_T2F_C4UB_V3F = 0x2A29, + GL_T2F_C3F_V3F = 0x2A2A, + GL_T2F_N3F_V3F = 0x2A2B, + GL_T2F_C4F_N3F_V3F = 0x2A2C, + GL_T4F_C4F_N3F_V4F = 0x2A2D, + + /* Matrix Mode */ + GL_MATRIX_MODE = 0x0BA0, + GL_MODELVIEW = 0x1700, + GL_PROJECTION = 0x1701, + GL_TEXTURE = 0x1702, + + /* Points */ + GL_POINT_SMOOTH = 0x0B10, + GL_POINT_SIZE = 0x0B11, + GL_POINT_SIZE_GRANULARITY = 0x0B13, + GL_POINT_SIZE_RANGE = 0x0B12, + + /* Lines */ + GL_LINE_SMOOTH = 0x0B20, + GL_LINE_STIPPLE = 0x0B24, + GL_LINE_STIPPLE_PATTERN = 0x0B25, + GL_LINE_STIPPLE_REPEAT = 0x0B26, + GL_LINE_WIDTH = 0x0B21, + GL_LINE_WIDTH_GRANULARITY = 0x0B23, + GL_LINE_WIDTH_RANGE = 0x0B22, + + /* Polygons */ + GL_POINT = 0x1B00, + GL_LINE = 0x1B01, + GL_FILL = 0x1B02, + GL_CCW = 0x0901, + GL_CW = 0x0900, + GL_FRONT = 0x0404, + GL_BACK = 0x0405, + GL_CULL_FACE = 0x0B44, + GL_CULL_FACE_MODE = 0x0B45, + GL_POLYGON_SMOOTH = 0x0B41, + GL_POLYGON_STIPPLE = 0x0B42, + GL_FRONT_FACE = 0x0B46, + GL_POLYGON_MODE = 0x0B40, + GL_POLYGON_OFFSET_FACTOR = 0x3038, + GL_POLYGON_OFFSET_UNITS = 0x2A00, + GL_POLYGON_OFFSET_POINT = 0x2A01, + GL_POLYGON_OFFSET_LINE = 0x2A02, + GL_POLYGON_OFFSET_FILL = 0x8037, + + /* Display Lists */ + GL_COMPILE = 0x1300, + GL_COMPILE_AND_EXECUTE = 0x1301, + GL_LIST_BASE = 0x0B32, + GL_LIST_INDEX = 0x0B33, + GL_LIST_MODE = 0x0B30, + + /* Depth buffer */ + GL_NEVER = 0x0200, + GL_LESS = 0x0201, + GL_GEQUAL = 0x0206, + GL_LEQUAL = 0x0203, + GL_GREATER = 0x0204, + GL_NOTEQUAL = 0x0205, + GL_EQUAL = 0x0202, + GL_ALWAYS = 0x0207, + GL_DEPTH_TEST = 0x0B71, + GL_DEPTH_BITS = 0x0D56, + GL_DEPTH_CLEAR_VALUE = 0x0B73, + GL_DEPTH_FUNC = 0x0B74, + GL_DEPTH_RANGE = 0x0B70, + GL_DEPTH_WRITEMASK = 0x0B72, + GL_DEPTH_COMPONENT = 0x1902, + + /* Lighting */ + GL_LIGHTING = 0x0B50, + GL_LIGHT0 = 0x4000, + GL_LIGHT1 = 0x4001, + GL_LIGHT2 = 0x4002, + GL_LIGHT3 = 0x4003, + GL_LIGHT4 = 0x4004, + GL_LIGHT5 = 0x4005, + GL_LIGHT6 = 0x4006, + GL_LIGHT7 = 0x4007, + GL_SPOT_EXPONENT = 0x1205, + GL_SPOT_CUTOFF = 0x1206, + GL_CONSTANT_ATTENUATION = 0x1207, + GL_LINEAR_ATTENUATION = 0x1208, + GL_QUADRATIC_ATTENUATION = 0x1209, + GL_AMBIENT = 0x1200, + GL_DIFFUSE = 0x1201, + GL_SPECULAR = 0x1202, + GL_SHININESS = 0x1601, + GL_EMISSION = 0x1600, + GL_POSITION = 0x1203, + GL_SPOT_DIRECTION = 0x1204, + GL_AMBIENT_AND_DIFFUSE = 0x1602, + GL_COLOR_INDEXES = 0x1603, + GL_LIGHT_MODEL_TWO_SIDE = 0x0B52, + GL_LIGHT_MODEL_LOCAL_VIEWER = 0x0B51, + GL_LIGHT_MODEL_AMBIENT = 0x0B53, + GL_FRONT_AND_BACK = 0x0408, + GL_SHADE_MODEL = 0x0B54, + GL_FLAT = 0x1D00, + GL_SMOOTH = 0x1D01, + GL_COLOR_MATERIAL = 0x0B57, + GL_COLOR_MATERIAL_FACE = 0x0B55, + GL_COLOR_MATERIAL_PARAMETER = 0x0B56, + GL_NORMALIZE = 0x0BA1, + + /* User clipping planes */ + GL_CLIP_PLANE0 = 0x3000, + GL_CLIP_PLANE1 = 0x3001, + GL_CLIP_PLANE2 = 0x3002, + GL_CLIP_PLANE3 = 0x3003, + GL_CLIP_PLANE4 = 0x3004, + GL_CLIP_PLANE5 = 0x3005, + + /* Accumulation buffer */ + GL_ACCUM_RED_BITS = 0x0D58, + GL_ACCUM_GREEN_BITS = 0x0D59, + GL_ACCUM_BLUE_BITS = 0x0D5A, + GL_ACCUM_ALPHA_BITS = 0x0D5B, + GL_ACCUM_CLEAR_VALUE = 0x0B80, + GL_ACCUM = 0x0100, + GL_ADD = 0x0104, + GL_LOAD = 0x0101, + GL_MULT = 0x0103, + GL_RETURN = 0x0102, + + /* Alpha testing */ + GL_ALPHA_TEST = 0x0BC0, + GL_ALPHA_TEST_REF = 0x0BC2, + GL_ALPHA_TEST_FUNC = 0x0BC1, + + /* Blending */ + GL_BLEND = 0x0BE2, + GL_BLEND_SRC = 0x0BE1, + GL_BLEND_DST = 0x0BE0, + GL_ZERO = 0, + GL_ONE = 1, + GL_SRC_COLOR = 0x0300, + GL_ONE_MINUS_SRC_COLOR = 0x0301, + GL_DST_COLOR = 0x0306, + GL_ONE_MINUS_DST_COLOR = 0x0307, + GL_SRC_ALPHA = 0x0302, + GL_ONE_MINUS_SRC_ALPHA = 0x0303, + GL_DST_ALPHA = 0x0304, + GL_ONE_MINUS_DST_ALPHA = 0x0305, + GL_SRC_ALPHA_SATURATE = 0x0308, + GL_CONSTANT_COLOR = 0x8001, + GL_ONE_MINUS_CONSTANT_COLOR = 0x8002, + GL_CONSTANT_ALPHA = 0x8003, + GL_ONE_MINUS_CONSTANT_ALPHA = 0x8004, + + /* Render Mode */ + GL_FEEDBACK = 0x1C01, + GL_RENDER = 0x1C00, + GL_SELECT = 0x1C02, + + /* Feedback */ + GL_2D = 0x0600, + GL_3D = 0x0601, + GL_3D_COLOR = 0x0602, + GL_3D_COLOR_TEXTURE = 0x0603, + GL_4D_COLOR_TEXTURE = 0x0604, + GL_POINT_TOKEN = 0x0701, + GL_LINE_TOKEN = 0x0702, + GL_LINE_RESET_TOKEN = 0x0707, + GL_POLYGON_TOKEN = 0x0703, + GL_BITMAP_TOKEN = 0x0704, + GL_DRAW_PIXEL_TOKEN = 0x0705, + GL_COPY_PIXEL_TOKEN = 0x0706, + GL_PASS_THROUGH_TOKEN = 0x0700, + + /* Fog */ + GL_FOG = 0x0B60, + GL_FOG_MODE = 0x0B65, + GL_FOG_DENSITY = 0x0B62, + GL_FOG_COLOR = 0x0B66, + GL_FOG_INDEX = 0x0B61, + GL_FOG_START = 0x0B63, + GL_FOG_END = 0x0B64, + GL_LINEAR = 0x2601, + GL_EXP = 0x0800, + GL_EXP2 = 0x0801, + + /* Logic Ops */ + GL_LOGIC_OP = 0x0BF1, + GL_LOGIC_OP_MODE = 0x0BF0, + GL_CLEAR = 0x1500, + GL_SET = 0x150F, + GL_COPY = 0x1503, + GL_COPY_INVERTED = 0x150C, + GL_NOOP = 0x1505, + GL_INVERT = 0x150A, + GL_AND = 0x1501, + GL_NAND = 0x150E, + GL_OR = 0x1507, + GL_NOR = 0x1508, + GL_XOR = 0x1506, + GL_EQUIV = 0x1509, + GL_AND_REVERSE = 0x1502, + GL_AND_INVERTED = 0x1504, + GL_OR_REVERSE = 0x150B, + GL_OR_INVERTED = 0x150D, + + /* Stencil */ + GL_STENCIL_TEST = 0x0B90, + GL_STENCIL_WRITEMASK = 0x0B98, + GL_STENCIL_BITS = 0x0D57, + GL_STENCIL_FUNC = 0x0B92, + GL_STENCIL_VALUE_MASK = 0x0B93, + GL_STENCIL_REF = 0x0B97, + GL_STENCIL_FAIL = 0x0B94, + GL_STENCIL_PASS_DEPTH_PASS = 0x0B96, + GL_STENCIL_PASS_DEPTH_FAIL = 0x0B95, + GL_STENCIL_CLEAR_VALUE = 0x0B91, + GL_STENCIL_INDEX = 0x1901, + GL_KEEP = 0x1E00, + GL_REPLACE = 0x1E01, + GL_INCR = 0x1E02, + GL_DECR = 0x1E03, + + /* Buffers, Pixel Drawing/Reading */ + GL_NONE = 0, + GL_LEFT = 0x0406, + GL_RIGHT = 0x0407, + /*GL_FRONT = 0x0404, */ + /*GL_BACK = 0x0405, */ + /*GL_FRONT_AND_BACK = 0x0408, */ + GL_FRONT_LEFT = 0x0400, + GL_FRONT_RIGHT = 0x0401, + GL_BACK_LEFT = 0x0402, + GL_BACK_RIGHT = 0x0403, + GL_AUX0 = 0x0409, + GL_AUX1 = 0x040A, + GL_AUX2 = 0x040B, + GL_AUX3 = 0x040C, + GL_COLOR_INDEX = 0x1900, + GL_RED = 0x1903, + GL_GREEN = 0x1904, + GL_BLUE = 0x1905, + GL_ALPHA = 0x1906, + GL_LUMINANCE = 0x1909, + GL_LUMINANCE_ALPHA = 0x190A, + GL_ALPHA_BITS = 0x0D55, + GL_RED_BITS = 0x0D52, + GL_GREEN_BITS = 0x0D53, + GL_BLUE_BITS = 0x0D54, + GL_INDEX_BITS = 0x0D51, + GL_SUBPIXEL_BITS = 0x0D50, + GL_AUX_BUFFERS = 0x0C00, + GL_READ_BUFFER = 0x0C02, + GL_DRAW_BUFFER = 0x0C01, + GL_DOUBLEBUFFER = 0x0C32, + GL_STEREO = 0x0C33, + GL_BITMAP = 0x1A00, + GL_COLOR = 0x1800, + GL_DEPTH = 0x1801, + GL_STENCIL = 0x1802, + GL_DITHER = 0x0BD0, + GL_RGB = 0x1907, + GL_RGBA = 0x1908, + + /* Implementation limits */ + GL_MAX_LIST_NESTING = 0x0B31, + GL_MAX_ATTRIB_STACK_DEPTH = 0x0D35, + GL_MAX_MODELVIEW_STACK_DEPTH = 0x0D36, + GL_MAX_NAME_STACK_DEPTH = 0x0D37, + GL_MAX_PROJECTION_STACK_DEPTH = 0x0D38, + GL_MAX_TEXTURE_STACK_DEPTH = 0x0D39, + GL_MAX_EVAL_ORDER = 0x0D30, + GL_MAX_LIGHTS = 0x0D31, + GL_MAX_CLIP_PLANES = 0x0D32, + GL_MAX_TEXTURE_SIZE = 0x0D33, + GL_MAX_PIXEL_MAP_TABLE = 0x0D34, + GL_MAX_VIEWPORT_DIMS = 0x0D3A, + GL_MAX_CLIENT_ATTRIB_STACK_DEPTH= 0x0D3B, + + /* Gets */ + GL_ATTRIB_STACK_DEPTH = 0x0BB0, + GL_COLOR_CLEAR_VALUE = 0x0C22, + GL_COLOR_WRITEMASK = 0x0C23, + GL_CURRENT_INDEX = 0x0B01, + GL_CURRENT_COLOR = 0x0B00, + GL_CURRENT_NORMAL = 0x0B02, + GL_CURRENT_RASTER_COLOR = 0x0B04, + GL_CURRENT_RASTER_DISTANCE = 0x0B09, + GL_CURRENT_RASTER_INDEX = 0x0B05, + GL_CURRENT_RASTER_POSITION = 0x0B07, + GL_CURRENT_RASTER_TEXTURE_COORDS = 0x0B06, + GL_CURRENT_RASTER_POSITION_VALID = 0x0B08, + GL_CURRENT_TEXTURE_COORDS = 0x0B03, + GL_INDEX_CLEAR_VALUE = 0x0C20, + GL_INDEX_MODE = 0x0C30, + GL_INDEX_WRITEMASK = 0x0C21, + GL_MODELVIEW_MATRIX = 0x0BA6, + GL_MODELVIEW_STACK_DEPTH = 0x0BA3, + GL_NAME_STACK_DEPTH = 0x0D70, + GL_PROJECTION_MATRIX = 0x0BA7, + GL_PROJECTION_STACK_DEPTH = 0x0BA4, + GL_RENDER_MODE = 0x0C40, + GL_RGBA_MODE = 0x0C31, + GL_TEXTURE_MATRIX = 0x0BA8, + GL_TEXTURE_STACK_DEPTH = 0x0BA5, + GL_VIEWPORT = 0x0BA2, + + + /* Evaluators */ + GL_AUTO_NORMAL = 0x0D80, + GL_MAP1_COLOR_4 = 0x0D90, + GL_MAP1_GRID_DOMAIN = 0x0DD0, + GL_MAP1_GRID_SEGMENTS = 0x0DD1, + GL_MAP1_INDEX = 0x0D91, + GL_MAP1_NORMAL = 0x0D92, + GL_MAP1_TEXTURE_COORD_1 = 0x0D93, + GL_MAP1_TEXTURE_COORD_2 = 0x0D94, + GL_MAP1_TEXTURE_COORD_3 = 0x0D95, + GL_MAP1_TEXTURE_COORD_4 = 0x0D96, + GL_MAP1_VERTEX_3 = 0x0D97, + GL_MAP1_VERTEX_4 = 0x0D98, + GL_MAP2_COLOR_4 = 0x0DB0, + GL_MAP2_GRID_DOMAIN = 0x0DD2, + GL_MAP2_GRID_SEGMENTS = 0x0DD3, + GL_MAP2_INDEX = 0x0DB1, + GL_MAP2_NORMAL = 0x0DB2, + GL_MAP2_TEXTURE_COORD_1 = 0x0DB3, + GL_MAP2_TEXTURE_COORD_2 = 0x0DB4, + GL_MAP2_TEXTURE_COORD_3 = 0x0DB5, + GL_MAP2_TEXTURE_COORD_4 = 0x0DB6, + GL_MAP2_VERTEX_3 = 0x0DB7, + GL_MAP2_VERTEX_4 = 0x0DB8, + GL_COEFF = 0x0A00, + GL_DOMAIN = 0x0A02, + GL_ORDER = 0x0A01, + + /* Hints */ + GL_FOG_HINT = 0x0C54, + GL_LINE_SMOOTH_HINT = 0x0C52, + GL_PERSPECTIVE_CORRECTION_HINT = 0x0C50, + GL_POINT_SMOOTH_HINT = 0x0C51, + GL_POLYGON_SMOOTH_HINT = 0x0C53, + GL_DONT_CARE = 0x1100, + GL_FASTEST = 0x1101, + GL_NICEST = 0x1102, + + /* Scissor box */ + GL_SCISSOR_TEST = 0x0C11, + GL_SCISSOR_BOX = 0x0C10, + + /* Pixel Mode / Transfer */ + GL_MAP_COLOR = 0x0D10, + GL_MAP_STENCIL = 0x0D11, + GL_INDEX_SHIFT = 0x0D12, + GL_INDEX_OFFSET = 0x0D13, + GL_RED_SCALE = 0x0D14, + GL_RED_BIAS = 0x0D15, + GL_GREEN_SCALE = 0x0D18, + GL_GREEN_BIAS = 0x0D19, + GL_BLUE_SCALE = 0x0D1A, + GL_BLUE_BIAS = 0x0D1B, + GL_ALPHA_SCALE = 0x0D1C, + GL_ALPHA_BIAS = 0x0D1D, + GL_DEPTH_SCALE = 0x0D1E, + GL_DEPTH_BIAS = 0x0D1F, + GL_PIXEL_MAP_S_TO_S_SIZE = 0x0CB1, + GL_PIXEL_MAP_I_TO_I_SIZE = 0x0CB0, + GL_PIXEL_MAP_I_TO_R_SIZE = 0x0CB2, + GL_PIXEL_MAP_I_TO_G_SIZE = 0x0CB3, + GL_PIXEL_MAP_I_TO_B_SIZE = 0x0CB4, + GL_PIXEL_MAP_I_TO_A_SIZE = 0x0CB5, + GL_PIXEL_MAP_R_TO_R_SIZE = 0x0CB6, + GL_PIXEL_MAP_G_TO_G_SIZE = 0x0CB7, + GL_PIXEL_MAP_B_TO_B_SIZE = 0x0CB8, + GL_PIXEL_MAP_A_TO_A_SIZE = 0x0CB9, + GL_PIXEL_MAP_S_TO_S = 0x0C71, + GL_PIXEL_MAP_I_TO_I = 0x0C70, + GL_PIXEL_MAP_I_TO_R = 0x0C72, + GL_PIXEL_MAP_I_TO_G = 0x0C73, + GL_PIXEL_MAP_I_TO_B = 0x0C74, + GL_PIXEL_MAP_I_TO_A = 0x0C75, + GL_PIXEL_MAP_R_TO_R = 0x0C76, + GL_PIXEL_MAP_G_TO_G = 0x0C77, + GL_PIXEL_MAP_B_TO_B = 0x0C78, + GL_PIXEL_MAP_A_TO_A = 0x0C79, + GL_PACK_ALIGNMENT = 0x0D05, + GL_PACK_LSB_FIRST = 0x0D01, + GL_PACK_ROW_LENGTH = 0x0D02, + GL_PACK_SKIP_PIXELS = 0x0D04, + GL_PACK_SKIP_ROWS = 0x0D03, + GL_PACK_SWAP_BYTES = 0x0D00, + GL_UNPACK_ALIGNMENT = 0x0CF5, + GL_UNPACK_LSB_FIRST = 0x0CF1, + GL_UNPACK_ROW_LENGTH = 0x0CF2, + GL_UNPACK_SKIP_PIXELS = 0x0CF4, + GL_UNPACK_SKIP_ROWS = 0x0CF3, + GL_UNPACK_SWAP_BYTES = 0x0CF0, + GL_ZOOM_X = 0x0D16, + GL_ZOOM_Y = 0x0D17, + + /* Texture mapping */ + GL_TEXTURE_ENV = 0x2300, + GL_TEXTURE_ENV_MODE = 0x2200, + GL_TEXTURE_1D = 0x0DE0, + GL_TEXTURE_2D = 0x0DE1, + GL_TEXTURE_WRAP_S = 0x2802, + GL_TEXTURE_WRAP_T = 0x2803, + GL_TEXTURE_MAG_FILTER = 0x2800, + GL_TEXTURE_MIN_FILTER = 0x2801, + GL_TEXTURE_ENV_COLOR = 0x2201, + GL_TEXTURE_GEN_S = 0x0C60, + GL_TEXTURE_GEN_T = 0x0C61, + GL_TEXTURE_GEN_MODE = 0x2500, + GL_TEXTURE_BORDER_COLOR = 0x1004, + GL_TEXTURE_WIDTH = 0x1000, + GL_TEXTURE_HEIGHT = 0x1001, + GL_TEXTURE_BORDER = 0x1005, + GL_TEXTURE_COMPONENTS = 0x1003, + GL_NEAREST_MIPMAP_NEAREST = 0x2700, + GL_NEAREST_MIPMAP_LINEAR = 0x2702, + GL_LINEAR_MIPMAP_NEAREST = 0x2701, + GL_LINEAR_MIPMAP_LINEAR = 0x2703, + GL_OBJECT_LINEAR = 0x2401, + GL_OBJECT_PLANE = 0x2501, + GL_EYE_LINEAR = 0x2400, + GL_EYE_PLANE = 0x2502, + GL_SPHERE_MAP = 0x2402, + GL_DECAL = 0x2101, + GL_MODULATE = 0x2100, + GL_NEAREST = 0x2600, + GL_REPEAT = 0x2901, + GL_CLAMP = 0x2900, + GL_S = 0x2000, + GL_T = 0x2001, + GL_R = 0x2002, + GL_Q = 0x2003, + GL_TEXTURE_GEN_R = 0x0C62, + GL_TEXTURE_GEN_Q = 0x0C63, + + GL_PROXY_TEXTURE_1D = 0x8063, + GL_PROXY_TEXTURE_2D = 0x8064, + GL_TEXTURE_PRIORITY = 0x8066, + GL_TEXTURE_RESIDENT = 0x8067, + GL_TEXTURE_1D_BINDING = 0x8068, + GL_TEXTURE_2D_BINDING = 0x8069, + + /* Internal texture formats */ + GL_ALPHA4 = 0x803B, + GL_ALPHA8 = 0x803C, + GL_ALPHA12 = 0x803D, + GL_ALPHA16 = 0x803E, + GL_LUMINANCE4 = 0x803F, + GL_LUMINANCE8 = 0x8040, + GL_LUMINANCE12 = 0x8041, + GL_LUMINANCE16 = 0x8042, + GL_LUMINANCE4_ALPHA4 = 0x8043, + GL_LUMINANCE6_ALPHA2 = 0x8044, + GL_LUMINANCE8_ALPHA8 = 0x8045, + GL_LUMINANCE12_ALPHA4 = 0x8046, + GL_LUMINANCE12_ALPHA12 = 0x8047, + GL_LUMINANCE16_ALPHA16 = 0x8048, + GL_INTENSITY = 0x8049, + GL_INTENSITY4 = 0x804A, + GL_INTENSITY8 = 0x804B, + GL_INTENSITY12 = 0x804C, + GL_INTENSITY16 = 0x804D, + GL_R3_G3_B2 = 0x2A10, + GL_RGB4 = 0x804F, + GL_RGB5 = 0x8050, + GL_RGB8 = 0x8051, + GL_RGB10 = 0x8052, + GL_RGB12 = 0x8053, + GL_RGB16 = 0x8054, + GL_RGBA2 = 0x8055, + GL_RGBA4 = 0x8056, + GL_RGB5_A1 = 0x8057, + GL_RGBA8 = 0x8058, + GL_RGB10_A2 = 0x8059, + GL_RGBA12 = 0x805A, + GL_RGBA16 = 0x805B, + + /* Utility */ + GL_VENDOR = 0x1F00, + GL_RENDERER = 0x1F01, + GL_VERSION = 0x1F02, + GL_EXTENSIONS = 0x1F03, + + /* Errors */ + GL_INVALID_VALUE = 0x0501, + GL_INVALID_ENUM = 0x0500, + GL_INVALID_OPERATION = 0x0502, + GL_STACK_OVERFLOW = 0x0503, + GL_STACK_UNDERFLOW = 0x0504, + GL_OUT_OF_MEMORY = 0x0505, + + /* + * 1.0 Extensions + */ + /* GL_EXT_blend_minmax and GL_EXT_blend_color */ + GL_CONSTANT_COLOR_EXT = 0x8001, + GL_ONE_MINUS_CONSTANT_COLOR_EXT = 0x8002, + GL_CONSTANT_ALPHA_EXT = 0x8003, + GL_ONE_MINUS_CONSTANT_ALPHA_EXT = 0x8004, + GL_BLEND_EQUATION_EXT = 0x8009, + GL_MIN_EXT = 0x8007, + GL_MAX_EXT = 0x8008, + GL_FUNC_ADD_EXT = 0x8006, + GL_FUNC_SUBTRACT_EXT = 0x800A, + GL_FUNC_REVERSE_SUBTRACT_EXT = 0x800B, + GL_BLEND_COLOR_EXT = 0x8005, + + /* GL_EXT_polygon_offset */ + GL_POLYGON_OFFSET_EXT = 0x8037, + GL_POLYGON_OFFSET_FACTOR_EXT = 0x8038, + GL_POLYGON_OFFSET_BIAS_EXT = 0x8039, + + /* GL_EXT_vertex_array */ + GL_VERTEX_ARRAY_EXT = 0x8074, + GL_NORMAL_ARRAY_EXT = 0x8075, + GL_COLOR_ARRAY_EXT = 0x8076, + GL_INDEX_ARRAY_EXT = 0x8077, + GL_TEXTURE_COORD_ARRAY_EXT = 0x8078, + GL_EDGE_FLAG_ARRAY_EXT = 0x8079, + GL_VERTEX_ARRAY_SIZE_EXT = 0x807A, + GL_VERTEX_ARRAY_TYPE_EXT = 0x807B, + GL_VERTEX_ARRAY_STRIDE_EXT = 0x807C, + GL_VERTEX_ARRAY_COUNT_EXT = 0x807D, + GL_NORMAL_ARRAY_TYPE_EXT = 0x807E, + GL_NORMAL_ARRAY_STRIDE_EXT = 0x807F, + GL_NORMAL_ARRAY_COUNT_EXT = 0x8080, + GL_COLOR_ARRAY_SIZE_EXT = 0x8081, + GL_COLOR_ARRAY_TYPE_EXT = 0x8082, + GL_COLOR_ARRAY_STRIDE_EXT = 0x8083, + GL_COLOR_ARRAY_COUNT_EXT = 0x8084, + GL_INDEX_ARRAY_TYPE_EXT = 0x8085, + GL_INDEX_ARRAY_STRIDE_EXT = 0x8086, + GL_INDEX_ARRAY_COUNT_EXT = 0x8087, + GL_TEXTURE_COORD_ARRAY_SIZE_EXT = 0x8088, + GL_TEXTURE_COORD_ARRAY_TYPE_EXT = 0x8089, + GL_TEXTURE_COORD_ARRAY_STRIDE_EXT= 0x808A, + GL_TEXTURE_COORD_ARRAY_COUNT_EXT= 0x808B, + GL_EDGE_FLAG_ARRAY_STRIDE_EXT = 0x808C, + GL_EDGE_FLAG_ARRAY_COUNT_EXT = 0x808D, + GL_VERTEX_ARRAY_POINTER_EXT = 0x808E, + GL_NORMAL_ARRAY_POINTER_EXT = 0x808F, + GL_COLOR_ARRAY_POINTER_EXT = 0x8090, + GL_INDEX_ARRAY_POINTER_EXT = 0x8091, + GL_TEXTURE_COORD_ARRAY_POINTER_EXT= 0x8092, + GL_EDGE_FLAG_ARRAY_POINTER_EXT = 0x8093 + +}; + +enum { + GL_CURRENT_BIT = 0x00000001, + GL_POINT_BIT = 0x00000002, + GL_LINE_BIT = 0x00000004, + GL_POLYGON_BIT = 0x00000008, + GL_POLYGON_STIPPLE_BIT = 0x00000010, + GL_PIXEL_MODE_BIT = 0x00000020, + GL_LIGHTING_BIT = 0x00000040, + GL_FOG_BIT = 0x00000080, + GL_DEPTH_BUFFER_BIT = 0x00000100, + GL_ACCUM_BUFFER_BIT = 0x00000200, + GL_STENCIL_BUFFER_BIT = 0x00000400, + GL_VIEWPORT_BIT = 0x00000800, + GL_TRANSFORM_BIT = 0x00001000, + GL_ENABLE_BIT = 0x00002000, + GL_COLOR_BUFFER_BIT = 0x00004000, + GL_HINT_BIT = 0x00008000, + GL_EVAL_BIT = 0x00010000, + GL_LIST_BIT = 0x00020000, + GL_TEXTURE_BIT = 0x00040000, + GL_SCISSOR_BIT = 0x00080000, + GL_ALL_ATTRIB_BITS = 0x000fffff +}; + +/* some types */ + +typedef int GLenum; +typedef void GLvoid; +typedef unsigned char GLboolean; +typedef signed char GLbyte; /* 1-byte signed */ +typedef short GLshort; /* 2-byte signed */ +typedef int GLint; /* 4-byte signed */ +typedef unsigned char GLubyte; /* 1-byte unsigned */ +typedef unsigned short GLushort; /* 2-byte unsigned */ +typedef unsigned int GLuint; /* 4-byte unsigned */ +typedef float GLfloat; /* single precision float */ +typedef double GLdouble; /* double precision float */ +typedef int GLsizei; + +/* functions */ + +void glEnable(int code); +void glDisable(int code); + +void glShadeModel(int mode); +void glCullFace(int mode); +void glPolygonMode(int face,int mode); + +void glBegin(int type); +void glEnd(void); + +#define PROTO_GL1(name) \ +void gl ## name ## 1f(float); \ +void gl ## name ## 1d(double); \ +void gl ## name ## 1fv(float *); \ +void gl ## name ## 1dv(double *); + +#define PROTO_GL2(name) \ +void gl ## name ## 2f(float ,float); \ +void gl ## name ## 2d(double ,double); \ +void gl ## name ## 2fv(float *); \ +void gl ## name ## 2dv(double *); + +#define PROTO_GL3(name) \ +void gl ## name ## 3f(float ,float ,float); \ +void gl ## name ## 3d(double ,double ,double); \ +void gl ## name ## 3fv(float *); \ +void gl ## name ## 3dv(double *); + +#define PROTO_GL4(name) \ +void gl ## name ## 4f(float ,float ,float, float ); \ +void gl ## name ## 4d(double ,double ,double, double ); \ +void gl ## name ## 4fv(float *); \ +void gl ## name ## 4dv(double *); + +PROTO_GL2(Vertex) +PROTO_GL3(Vertex) +PROTO_GL4(Vertex) + +PROTO_GL3(Color) +PROTO_GL4(Color) + +PROTO_GL3(Normal) + +PROTO_GL1(TexCoord) +PROTO_GL2(TexCoord) +PROTO_GL3(TexCoord) +PROTO_GL4(TexCoord) + +void glEdgeFlag(int flag); + +/* matrix */ +void glMatrixMode(int mode); +void glLoadMatrixf(const float *m); +void glLoadIdentity(void); +void glMultMatrixf(const float *m); +void glPushMatrix(void); +void glPopMatrix(void); +void glRotatef(float angle,float x,float y,float z); +void glTranslatef(float x,float y,float z); +void glScalef(float x,float y,float z); + +void glViewport(int x,int y,int width,int height); +void glFrustum(double left,double right,double bottom,double top, + double near_,double far_); + +/* lists */ +unsigned int glGenLists(int range); +int glIsList(unsigned int list); +void glNewList(unsigned int list,int mode); +void glEndList(void); +void glCallList(unsigned int list); + +/* clear */ +void glClear(int mask); +void glClearColor(float r,float g,float b,float a); +void glClearDepth(double depth); + +/* selection */ +int glRenderMode(int mode); +void glSelectBuffer(int size,unsigned int *buf); + +void glInitNames(void); +void glPushName(unsigned int name); +void glPopName(void); +void glLoadName(unsigned int name); + +/* textures */ +void glGenTextures(int n, unsigned int *textures); +void glDeleteTextures(int n, const unsigned int *textures); +void glBindTexture(int target,int texture); +void glTexImage2D( int target, int level, int components, + int width, int height, int border, + int format, int type, void *pixels); +void glTexEnvi(int target,int pname,int param); +void glTexParameteri(int target,int pname,int param); +void glPixelStorei(int pname,int param); + +/* lighting */ + +void glMaterialfv(int mode,int type,float *v); +void glMaterialf(int mode,int type,float v); +void glColorMaterial(int mode,int type); + +void glLightfv(int light,int type,float *v); +void glLightf(int light,int type,float v); +void glLightModeli(int pname,int param); +void glLightModelfv(int pname,float *param); + +/* misc */ + +void glFlush(void); +void glHint(int target,int mode); +void glGetIntegerv(int pname,int *params); +void glGetFloatv(int pname, float *v); +void glFrontFace(int mode); + +/* opengl 1.2 arrays */ +void glEnableClientState(GLenum array); +void glDisableClientState(GLenum array); +void glArrayElement(GLint i); +void glVertexPointer(GLint size, GLenum type, GLsizei stride, + const GLvoid *pointer); +void glColorPointer(GLint size, GLenum type, GLsizei stride, + const GLvoid *pointer); +void glNormalPointer(GLenum type, GLsizei stride, + const GLvoid *pointer); +void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, + const GLvoid *pointer); + +/* opengl 1.2 polygon offset */ +void glPolygonOffset(GLfloat factor, GLfloat units); + +/* not implemented, just added to compile */ + /* +inline void glPointSize(float) {} +inline void glLineWidth(float) {} +inline void glDeleteLists(int, int) {} +inline void glDepthFunc(int) {} +inline void glBlendFunc(int, int) {} +inline void glTexEnvf(int, int, int) {} +inline void glOrtho(float,float,float,float,float,float){} +inline void glVertex2i(int,int) {} +inline void glDepthMask(int) {} +inline void glFogi(int, int) {} +inline void glFogfv(int, const float*) {} +inline void glFogf(int, float) {} +inline void glRasterPos2f(float, float) {} +inline void glPolygonStipple(void*) {} +inline void glTexParameterf(int, int, int) {}; + */ +/* non compatible functions */ + +void glDebug(int mode); + +void glInit(void *zbuffer); +void glClose(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/programs/develop/libraries/TinyGL/include/GL/glu.h b/programs/develop/libraries/TinyGL/include/GL/glu.h new file mode 100644 index 0000000000..81e847869c --- /dev/null +++ b/programs/develop/libraries/TinyGL/include/GL/glu.h @@ -0,0 +1,44 @@ + +#ifndef GLU_H +#define GLU_H + +#ifdef __cplusplus +extern "C" { +#endif + +void gluPerspective( GLdouble fovy, GLdouble aspect, + GLdouble zNear, GLdouble zFar ); + +void +gluLookAt(GLdouble eyex, GLdouble eyey, GLdouble eyez, + GLdouble centerx, GLdouble centery, GLdouble centerz, + GLdouble upx, GLdouble upy, GLdouble upz); + + +void drawTorus(float rc, int numc, float rt, int numt); + + + +typedef struct { + int draw_style; +} GLUquadricObj; + +#define GLU_LINE 0 + +GLUquadricObj* gluNewQuadric(void); +void gluQuadricDrawStyle(GLUquadricObj *obj, int style); + +void gluSphere(GLUquadricObj *qobj, + float radius,int slices,int stacks); +void gluCylinder( GLUquadricObj *qobj, + GLdouble baseRadius, GLdouble topRadius, GLdouble height, + GLint slices, GLint stacks ); +void gluDisk( GLUquadricObj *qobj, + GLdouble innerRadius, GLdouble outerRadius, + GLint slices, GLint loops ); + + +#ifdef __cplusplus +} +#endif +#endif diff --git a/programs/develop/libraries/TinyGL/include/kosgl.h b/programs/develop/libraries/TinyGL/include/kosgl.h new file mode 100644 index 0000000000..af1b099da4 --- /dev/null +++ b/programs/develop/libraries/TinyGL/include/kosgl.h @@ -0,0 +1,28 @@ +#ifndef KOSGL_H +#define KOSGL_H + +#include +#include + + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void *KOSGLContext; + +extern KOSGLContext kosglCreateContext( KOSGLContext shareList, int flags ); + +extern void kosglDestroyContext( KOSGLContext ctx1 ); + +extern int kosglMakeCurrent( int win_x0, int win_y0, + int win_x, int win_y, + KOSGLContext ctx); + +extern void kosglSwapBuffers(); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/programs/develop/libraries/TinyGL/src/Makefile b/programs/develop/libraries/TinyGL/src/Makefile new file mode 100644 index 0000000000..79ee44c77b --- /dev/null +++ b/programs/develop/libraries/TinyGL/src/Makefile @@ -0,0 +1,38 @@ +include ../config.mk + +OBJS= clip.o vertex.o api.o list.o init.o matrix.o texture.o \ + misc.o clear.o light.o select.o get.o error.o \ + zbuffer.o zline.o zdither.o ztriangle.o \ + zmath.o image_util.o msghandling.o \ + arrays.o specbuf.o glu.o kosgl.o + + +INCLUDES = -I$(TINYGL)/include -I$(MENUETDEV)/include +LIB = libTinyGL.a + +all: $(LIB) + +$(LIB): $(OBJS) + rm -f $(LIB) + ar rcs $(LIB) $(OBJS) + copy /y $@ $(TINYGL)\lib + del $(LIB) + +clean: + rm -f *~ *.o *.a $(TINYGL)/$(LIB) + +.c.o: + $(CC) $(CFLAGS) $(INCLUDES) -c $*.c + +clip.o: zgl.h zfeatures.h +vertex.o: zgl.h zfeatures.h +light.o: zgl.h zfeatures.h +matrix.o: zgl.h zfeatures.h +list.o: zgl.h opinfo.h zfeatures.h +arrays.c: zgl.h zfeatures.h +specbuf.o: zgl.h zfeatures.h +glx.o: zgl.h zfeatures.h +nglx.o: zgl.h zfeatures.h +zline.o: zgl.h zfeatures.h zline.h +ztriangle.o: ztriangle.c ztriangle.h zgl.h zfeatures.h + $(CC) $(CFLAGS) $(INCLUDES) -c $*.c diff --git a/programs/develop/libraries/TinyGL/src/Tupfile.lua b/programs/develop/libraries/TinyGL/src/Tupfile.lua new file mode 100644 index 0000000000..3e2f3a032a --- /dev/null +++ b/programs/develop/libraries/TinyGL/src/Tupfile.lua @@ -0,0 +1,7 @@ +if tup.getconfig("NO_GCC") ~= "" then return end +HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../../.." or tup.getconfig("HELPERDIR") +tup.include(HELPERDIR .. "/use_gcc.lua") +tup.include(HELPERDIR .. "/use_menuetlibc.lua") +INCLUDES = INCLUDES .. " -I../include" +compile_gcc("*.c") +tup.rule(OBJS, "kos32-ar rcs %o %f", {"../lib/libTinyGL.a", "../<>"}) diff --git a/programs/develop/libraries/TinyGL/src/api.c b/programs/develop/libraries/TinyGL/src/api.c new file mode 100644 index 0000000000..703f8907bd --- /dev/null +++ b/programs/develop/libraries/TinyGL/src/api.c @@ -0,0 +1,666 @@ +#include "zgl.h" +#include +/* glVertex */ + +void glVertex4f(float x,float y,float z,float w) +{ + GLParam p[5]; + + p[0].op=OP_Vertex; + p[1].f=x; + p[2].f=y; + p[3].f=z; + p[4].f=w; + + gl_add_op(p); +} + +void glVertex2f(float x,float y) +{ + glVertex4f(x,y,0,1); +} + +void glVertex3f(float x,float y,float z) +{ + glVertex4f(x,y,z,1); +} + +void glVertex3fv(float *v) +{ + glVertex4f(v[0],v[1],v[2],1); +} + +/* glNormal */ + +void glNormal3f(float x,float y,float z) +{ + GLParam p[4]; + + p[0].op=OP_Normal; + p[1].f=x; + p[2].f=y; + p[3].f=z; + + gl_add_op(p); +} + +void glNormal3fv(float *v) +{ + glNormal3f(v[0],v[1],v[2]); +} + +/* glColor */ + +void glColor4f(float r,float g,float b,float a) +{ + GLParam p[8]; + + p[0].op=OP_Color; + p[1].f=b; + p[2].f=g; + p[3].f=r; + p[4].f=a; + /* direct convertion to integer to go faster if no shading */ + RGBFtoRGBI(r,g,b,p[7].ui,p[6].ui,p[5].ui); + gl_add_op(p); +} + +void glColor4fv(float *v) +{ + GLParam p[8]; + + p[0].op=OP_Color; + p[1].f=v[2]; + p[2].f=v[1]; + p[3].f=v[0]; + p[4].f=v[3]; + /* direct convertion to integer to go faster if no shading */ + p[5].ui = (unsigned int) (v[2] * (ZB_POINT_RED_MAX - ZB_POINT_RED_MIN) + + ZB_POINT_RED_MIN); + p[6].ui = (unsigned int) (v[1] * (ZB_POINT_GREEN_MAX - ZB_POINT_GREEN_MIN) + + ZB_POINT_GREEN_MIN); + p[7].ui = (unsigned int) (v[0] * (ZB_POINT_BLUE_MAX - ZB_POINT_BLUE_MIN) + + ZB_POINT_BLUE_MIN); + gl_add_op(p); +} + +void glColor3f(float x,float y,float z) +{ + glColor4f(x,y,z,1); +} + +void glColor3fv(float *v) +{ + glColor4f(v[0],v[1],v[2],1); +} + + +/* TexCoord */ + +void glTexCoord4f(float s,float t,float r,float q) +{ + GLParam p[5]; + + p[0].op=OP_TexCoord; + p[1].f=s; + p[2].f=t; + p[3].f=r; + p[4].f=q; + + gl_add_op(p); +} + +void glTexCoord2f(float s,float t) +{ + glTexCoord4f(s,t,0,1); +} + +void glTexCoord2fv(float *v) +{ + glTexCoord4f(v[0],v[1],0,1); +} + +void glEdgeFlag(int flag) +{ + GLParam p[2]; + + p[0].op=OP_EdgeFlag; + p[1].i=flag; + + gl_add_op(p); +} + +/* misc */ + +void glShadeModel(int mode) +{ + GLParam p[2]; + + assert(mode == GL_FLAT || mode == GL_SMOOTH); + + p[0].op=OP_ShadeModel; + p[1].i=mode; + + gl_add_op(p); +} + +void glCullFace(int mode) +{ + GLParam p[2]; + + assert(mode == GL_BACK || + mode == GL_FRONT || + mode == GL_FRONT_AND_BACK); + + p[0].op=OP_CullFace; + p[1].i=mode; + + gl_add_op(p); +} + +void glFrontFace(int mode) +{ + GLParam p[2]; + + assert(mode == GL_CCW || mode == GL_CW); + + mode = (mode != GL_CCW); + + p[0].op=OP_FrontFace; + p[1].i=mode; + + gl_add_op(p); +} + +void glPolygonMode(int face,int mode) +{ + GLParam p[3]; + + assert(face == GL_BACK || + face == GL_FRONT || + face == GL_FRONT_AND_BACK); + assert(mode == GL_POINT || mode == GL_LINE || mode==GL_FILL); + + p[0].op=OP_PolygonMode; + p[1].i=face; + p[2].i=mode; + + gl_add_op(p); +} + + +/* glEnable / glDisable */ + +void glEnable(int cap) +{ + GLParam p[3]; + + p[0].op=OP_EnableDisable; + p[1].i=cap; + p[2].i=1; + + gl_add_op(p); +} + +void glDisable(int cap) +{ + GLParam p[3]; + + p[0].op=OP_EnableDisable; + p[1].i=cap; + p[2].i=0; + + gl_add_op(p); +} + +/* glBegin / glEnd */ + +void glBegin(int mode) +{ + GLParam p[2]; + + p[0].op=OP_Begin; + p[1].i=mode; + + gl_add_op(p); +} + +void glEnd(void) +{ + GLParam p[1]; + + p[0].op=OP_End; + + gl_add_op(p); +} + +/* matrix */ + +void glMatrixMode(int mode) +{ + GLParam p[2]; + + p[0].op=OP_MatrixMode; + p[1].i=mode; + + gl_add_op(p); +} + +void glLoadMatrixf(const float *m) +{ + GLParam p[17]; + int i; + + p[0].op=OP_LoadMatrix; + for(i=0;i<16;i++) p[i+1].f=m[i]; + + gl_add_op(p); +} + +void glLoadIdentity(void) +{ + GLParam p[1]; + + p[0].op=OP_LoadIdentity; + + gl_add_op(p); +} + +void glMultMatrixf(const float *m) +{ + GLParam p[17]; + int i; + + p[0].op=OP_MultMatrix; + for(i=0;i<16;i++) p[i+1].f=m[i]; + + gl_add_op(p); +} + +void glPushMatrix(void) +{ + GLParam p[1]; + + p[0].op=OP_PushMatrix; + + gl_add_op(p); +} + +void glPopMatrix(void) +{ + GLParam p[1]; + + p[0].op=OP_PopMatrix; + + gl_add_op(p); +} + +void glRotatef(float angle,float x,float y,float z) +{ + GLParam p[5]; + + p[0].op=OP_Rotate; + p[1].f=angle; + p[2].f=x; + p[3].f=y; + p[4].f=z; + + gl_add_op(p); +} + +void glTranslatef(float x,float y,float z) +{ + GLParam p[4]; + + p[0].op=OP_Translate; + p[1].f=x; + p[2].f=y; + p[3].f=z; + + gl_add_op(p); +} + +void glScalef(float x,float y,float z) +{ + GLParam p[4]; + + p[0].op=OP_Scale; + p[1].f=x; + p[2].f=y; + p[3].f=z; + + gl_add_op(p); +} + + +void glViewport(int x,int y,int width,int height) +{ + GLParam p[5]; + + p[0].op=OP_Viewport; + p[1].i=x; + p[2].i=y; + p[3].i=width; + p[4].i=height; + + gl_add_op(p); +} + +void glFrustum(double left,double right,double bottom,double top, + double near,double farv) +{ + GLParam p[7]; + + p[0].op=OP_Frustum; + p[1].f=left; + p[2].f=right; + p[3].f=bottom; + p[4].f=top; + p[5].f=near; + p[6].f=farv; + + gl_add_op(p); +} + +/* lightening */ + +void glMaterialfv(int mode,int type,float *v) +{ + GLParam p[7]; + int i,n; + + assert(mode == GL_FRONT || mode == GL_BACK || mode==GL_FRONT_AND_BACK); + + p[0].op=OP_Material; + p[1].i=mode; + p[2].i=type; + n=4; + if (type == GL_SHININESS) n=1; + + p[3].f=v[2]; + p[4].f=v[1]; + p[5].f=v[0]; + p[6].f=v[3]; + + for(i=n;i<4;i++) p[3+i].f=0; + + gl_add_op(p); +} + +void glMaterialf(int mode,int type,float v) +{ + GLParam p[7]; + int i; + + p[0].op=OP_Material; + p[1].i=mode; + p[2].i=type; + p[3].f=v; + for(i=0;i<3;i++) p[4+i].f=0; + + gl_add_op(p); +} + +void glColorMaterial(int mode,int type) +{ + GLParam p[3]; + + p[0].op=OP_ColorMaterial; + p[1].i=mode; + p[2].i=type; + + gl_add_op(p); +} + +void glLightfv(int light,int type,float *v) +{ + GLParam p[7]; + int i; + + p[0].op=OP_Light; + p[1].i=light; + p[2].i=type; + /* TODO: 3 composants ? */ + for(i=0;i<4;i++) p[3+i].f=v[i]; + + gl_add_op(p); +} + + +void glLightf(int light,int type,float v) +{ + GLParam p[7]; + int i; + + p[0].op=OP_Light; + p[1].i=light; + p[2].i=type; + p[3].f=v; + for(i=0;i<3;i++) p[4+i].f=0; + + gl_add_op(p); +} + +void glLightModeli(int pname,int param) +{ + GLParam p[6]; + int i; + + p[0].op=OP_LightModel; + p[1].i=pname; + p[2].f=(float)param; + for(i=0;i<4;i++) p[3+i].f=0; + + gl_add_op(p); +} + +void glLightModelfv(int pname,float *param) +{ + GLParam p[6]; + int i; + + p[0].op=OP_LightModel; + p[1].i=pname; + for(i=0;i<4;i++) p[2+i].f=param[i]; + + gl_add_op(p); +} + +/* clear */ + +void glClear(int mask) +{ + GLParam p[2]; + + p[0].op=OP_Clear; + p[1].i=mask; + + gl_add_op(p); +} + +void glClearColor(float r,float g,float b,float a) +{ + GLParam p[5]; + + p[0].op=OP_ClearColor; + p[1].f=b; + p[2].f=g; + p[3].f=r; + p[4].f=a; + + gl_add_op(p); +} + +void glClearDepth(double depth) +{ + GLParam p[2]; + + p[0].op=OP_ClearDepth; + p[1].f=depth; + + gl_add_op(p); +} + + +/* textures */ + +void glTexImage2D( int target, int level, int components, + int width, int height, int border, + int format, int type, void *pixels) +{ + GLParam p[10]; + + p[0].op=OP_TexImage2D; + p[1].i=target; + p[2].i=level; + p[3].i=components; + p[4].i=width; + p[5].i=height; + p[6].i=border; + p[7].i=format; + p[8].i=type; + p[9].p=pixels; + + gl_add_op(p); +} + + +void glBindTexture(int target,int texture) +{ + GLParam p[3]; + + p[0].op=OP_BindTexture; + p[1].i=target; + p[2].i=texture; + + gl_add_op(p); +} + +void glTexEnvi(int target,int pname,int param) +{ + GLParam p[8]; + + p[0].op=OP_TexEnv; + p[1].i=target; + p[2].i=pname; + p[3].i=param; + p[4].f=0; + p[5].f=0; + p[6].f=0; + p[7].f=0; + + gl_add_op(p); +} + +void glTexParameteri(int target,int pname,int param) +{ + GLParam p[8]; + + p[0].op=OP_TexParameter; + p[1].i=target; + p[2].i=pname; + p[3].i=param; + p[4].f=0; + p[5].f=0; + p[6].f=0; + p[7].f=0; + + gl_add_op(p); +} + +void glPixelStorei(int pname,int param) +{ + GLParam p[3]; + + p[0].op=OP_PixelStore; + p[1].i=pname; + p[2].i=param; + + gl_add_op(p); +} + +/* selection */ + +void glInitNames(void) +{ + GLParam p[1]; + + p[0].op=OP_InitNames; + + gl_add_op(p); +} + +void glPushName(unsigned int name) +{ + GLParam p[2]; + + p[0].op=OP_PushName; + p[1].i=name; + + gl_add_op(p); +} + +void glPopName(void) +{ + GLParam p[1]; + + p[0].op=OP_PopName; + + gl_add_op(p); +} + +void glLoadName(unsigned int name) +{ + GLParam p[2]; + + p[0].op=OP_LoadName; + p[1].i=name; + + gl_add_op(p); +} + +void +glPolygonOffset(GLfloat factor, GLfloat units) +{ + GLParam p[3]; + p[0].op = OP_PolygonOffset; + p[1].f = factor; + p[2].f = units; +} + +/* Special Functions */ + +void glCallList(unsigned int list) +{ + GLParam p[2]; + + p[0].op=OP_CallList; + p[1].i=list; + + gl_add_op(p); +} + +void glFlush(void) +{ + /* nothing to do */ +} + +void glHint(int target,int mode) +{ + GLParam p[3]; + + p[0].op=OP_Hint; + p[1].i=target; + p[2].i=mode; + + gl_add_op(p); +} + +/* Non standard functions */ + +void glDebug(int mode) +{ + GLContext *c=gl_get_context(); + c->print_flag=mode; +} + diff --git a/programs/develop/libraries/TinyGL/src/arrays.c b/programs/develop/libraries/TinyGL/src/arrays.c new file mode 100644 index 0000000000..9bb61a7f33 --- /dev/null +++ b/programs/develop/libraries/TinyGL/src/arrays.c @@ -0,0 +1,206 @@ +#include "zgl.h" +/*#include */ +#include + +#define VERTEX_ARRAY 0x0001 +#define COLOR_ARRAY 0x0002 +#define NORMAL_ARRAY 0x0004 +#define TEXCOORD_ARRAY 0x0008 + +void +glopArrayElement(GLContext *c, GLParam *param) +{ + int i; + int states = c->client_states; + int idx = param[1].i; + + if (states & COLOR_ARRAY) { + GLParam p[5]; + int size = c->color_array_size; + i = idx * (size + c->color_array_stride); + p[1].f = c->color_array[i]; + p[2].f = c->color_array[i+1]; + p[3].f = c->color_array[i+2]; + p[4].f = size > 3 ? c->color_array[i+3] : 1.0f; + glopColor(c, p); + } + if (states & NORMAL_ARRAY) { + i = idx * (3 + c->normal_array_stride); + c->current_normal.X = c->normal_array[i]; + c->current_normal.Y = c->normal_array[i+1]; + c->current_normal.Z = c->normal_array[i+2]; + c->current_normal.Z = 0.0f; + } + if (states & TEXCOORD_ARRAY) { + int size = c->texcoord_array_size; + i = idx * (size + c->texcoord_array_stride); + c->current_tex_coord.X = c->texcoord_array[i]; + c->current_tex_coord.Y = c->texcoord_array[i+1]; + c->current_tex_coord.Z = size > 2 ? c->texcoord_array[i+2] : 0.0f; + c->current_tex_coord.W = size > 3 ? c->texcoord_array[i+3] : 1.0f; + } + if (states & VERTEX_ARRAY) { + GLParam p[5]; + int size = c->vertex_array_size; + i = idx * (size + c->vertex_array_stride); + p[1].f = c->vertex_array[i]; + p[2].f = c->vertex_array[i+1]; + p[3].f = size > 2 ? c->vertex_array[i+2] : 0.0f; + p[4].f = size > 3 ? c->vertex_array[i+3] : 1.0f; + glopVertex(c, p); + } +} + +void +glArrayElement(GLint i) +{ + GLParam p[2]; + p[0].op = OP_ArrayElement; + p[1].i = i; + gl_add_op(p); +} + + +void +glopEnableClientState(GLContext *c, GLParam *p) +{ + c->client_states |= p[1].i; +} + +void +glEnableClientState(GLenum array) +{ + GLParam p[2]; + p[0].op = OP_EnableClientState; + + switch(array) { + case GL_VERTEX_ARRAY: + p[1].i = VERTEX_ARRAY; + break; + case GL_NORMAL_ARRAY: + p[1].i = NORMAL_ARRAY; + break; + case GL_COLOR_ARRAY: + p[1].i = COLOR_ARRAY; + break; + case GL_TEXTURE_COORD_ARRAY: + p[1].i = TEXCOORD_ARRAY; + break; + default: + assert(0); + break; + } + gl_add_op(p); +} + +void +glopDisableClientState(GLContext *c, GLParam *p) +{ + c->client_states &= p[1].i; +} + +void +glDisableClientState(GLenum array) +{ + GLParam p[2]; + p[0].op = OP_DisableClientState; + + switch(array) { + case GL_VERTEX_ARRAY: + p[1].i = ~VERTEX_ARRAY; + break; + case GL_NORMAL_ARRAY: + p[1].i = ~NORMAL_ARRAY; + break; + case GL_COLOR_ARRAY: + p[1].i = ~COLOR_ARRAY; + break; + case GL_TEXTURE_COORD_ARRAY: + p[1].i = ~TEXCOORD_ARRAY; + break; + default: + assert(0); + break; + } + gl_add_op(p); +} + +void +glopVertexPointer(GLContext *c, GLParam *p) +{ + c->vertex_array_size = p[1].i; + c->vertex_array_stride = p[2].i; + c->vertex_array = p[3].p; +} + +void +glVertexPointer(GLint size, GLenum type, GLsizei stride, + const GLvoid *pointer) +{ + GLParam p[4]; + assert(type == GL_FLOAT); + p[0].op = OP_VertexPointer; + p[1].i = size; + p[2].i = stride; + p[3].p = (void*)pointer; + gl_add_op(p); +} + +void +glopColorPointer(GLContext *c, GLParam *p) +{ + c->color_array_size = p[1].i; + c->color_array_stride = p[2].i; + c->color_array = p[3].p; +} + +void +glColorPointer(GLint size, GLenum type, GLsizei stride, + const GLvoid *pointer) +{ + GLParam p[4]; + assert(type == GL_FLOAT); + p[0].op = OP_ColorPointer; + p[1].i = size; + p[2].i = stride; + p[3].p = (void*)pointer; + gl_add_op(p); +} + +void +glopNormalPointer(GLContext *c, GLParam *p) +{ + c->normal_array_stride = p[1].i; + c->normal_array = p[2].p; +} + +void +glNormalPointer(GLenum type, GLsizei stride, + const GLvoid *pointer) +{ + GLParam p[3]; + assert(type == GL_FLOAT); + p[0].op = OP_NormalPointer; + p[1].i = stride; + p[2].p = (void*)pointer; +} + +void +glopTexCoordPointer(GLContext *c, GLParam *p) +{ + c->texcoord_array_size = p[1].i; + c->texcoord_array_stride = p[2].i; + c->texcoord_array = p[3].p; +} + +void +glTexCoordPointer(GLint size, GLenum type, GLsizei stride, + const GLvoid *pointer) +{ + GLParam p[4]; + assert(type == GL_FLOAT); + p[0].op = OP_TexCoordPointer; + p[1].i = size; + p[2].i = stride; + p[3].p = (void*)pointer; +} diff --git a/programs/develop/libraries/TinyGL/src/clear.c b/programs/develop/libraries/TinyGL/src/clear.c new file mode 100644 index 0000000000..f5b755859c --- /dev/null +++ b/programs/develop/libraries/TinyGL/src/clear.c @@ -0,0 +1,30 @@ +#include "zgl.h" + + +void glopClearColor(GLContext *c,GLParam *p) +{ + c->clear_color.v[0]=p[1].f; + c->clear_color.v[1]=p[2].f; + c->clear_color.v[2]=p[3].f; + c->clear_color.v[3]=p[4].f; +} +void glopClearDepth(GLContext *c,GLParam *p) +{ + c->clear_depth=p[1].f; +} + + +void glopClear(GLContext *c,GLParam *p) +{ + int mask=p[1].i; + int z=0; + int r=(int)(c->clear_color.v[0]*65535); + int g=(int)(c->clear_color.v[1]*65535); + int b=(int)(c->clear_color.v[2]*65535); + + /* TODO : correct value of Z */ + + ZB_clear(c->zb,mask & GL_DEPTH_BUFFER_BIT,z, + mask & GL_COLOR_BUFFER_BIT,r,g,b); +} + diff --git a/programs/develop/libraries/TinyGL/src/clip.c b/programs/develop/libraries/TinyGL/src/clip.c new file mode 100644 index 0000000000..c387adc004 --- /dev/null +++ b/programs/develop/libraries/TinyGL/src/clip.c @@ -0,0 +1,450 @@ +#include "zgl.h" + +/* fill triangle profile */ +/* #define PROFILE */ + +#define CLIP_XMIN (1<<0) +#define CLIP_XMAX (1<<1) +#define CLIP_YMIN (1<<2) +#define CLIP_YMAX (1<<3) +#define CLIP_ZMIN (1<<4) +#define CLIP_ZMAX (1<<5) + +void gl_transform_to_viewport(GLContext *c,GLVertex *v) +{ + float winv; + + /* coordinates */ + winv=1.0/v->pc.W; + v->zp.x= (int) ( v->pc.X * winv * c->viewport.scale.X + + c->viewport.trans.X ); + v->zp.y= (int) ( v->pc.Y * winv * c->viewport.scale.Y + + c->viewport.trans.Y ); + v->zp.z= (int) ( v->pc.Z * winv * c->viewport.scale.Z + + c->viewport.trans.Z ); + /* color */ + if (c->lighting_enabled) { + v->zp.r=(int)(v->color.v[0] * (ZB_POINT_RED_MAX - ZB_POINT_RED_MIN) + + ZB_POINT_RED_MIN); + v->zp.g=(int)(v->color.v[1] * (ZB_POINT_GREEN_MAX - ZB_POINT_GREEN_MIN) + + ZB_POINT_GREEN_MIN); + v->zp.b=(int)(v->color.v[2] * (ZB_POINT_BLUE_MAX - ZB_POINT_BLUE_MIN) + + ZB_POINT_BLUE_MIN); + } else { + /* no need to convert to integer if no lighting : take current color */ + v->zp.r = c->longcurrent_color[0]; + v->zp.g = c->longcurrent_color[1]; + v->zp.b = c->longcurrent_color[2]; + } + + /* texture */ + + if (c->texture_2d_enabled) { + v->zp.s=(int)(v->tex_coord.X * (ZB_POINT_S_MAX - ZB_POINT_S_MIN) + + ZB_POINT_S_MIN); + v->zp.t=(int)(v->tex_coord.Y * (ZB_POINT_T_MAX - ZB_POINT_T_MIN) + + ZB_POINT_T_MIN); + } +} + + +static void gl_add_select1(GLContext *c,int z1,int z2,int z3) +{ + unsigned int min,max; + min=max=z1; + if (z2max) max=z2; + if (z3>max) max=z3; + + gl_add_select(c,0xffffffff-min,0xffffffff-max); +} + +/* point */ + +void gl_draw_point(GLContext *c,GLVertex *p0) +{ + if (p0->clip_code == 0) { + if (c->render_mode == GL_SELECT) { + gl_add_select(c,p0->zp.z,p0->zp.z); + } else { + ZB_plot(c->zb,&p0->zp); + } + } +} + +/* line */ + +static inline void interpolate(GLVertex *q,GLVertex *p0,GLVertex *p1,float t) +{ + q->pc.X=p0->pc.X+(p1->pc.X-p0->pc.X)*t; + q->pc.Y=p0->pc.Y+(p1->pc.Y-p0->pc.Y)*t; + q->pc.Z=p0->pc.Z+(p1->pc.Z-p0->pc.Z)*t; + q->pc.W=p0->pc.W+(p1->pc.W-p0->pc.W)*t; + + q->color.v[0]=p0->color.v[0] + (p1->color.v[0]-p0->color.v[0])*t; + q->color.v[1]=p0->color.v[1] + (p1->color.v[1]-p0->color.v[1])*t; + q->color.v[2]=p0->color.v[2] + (p1->color.v[2]-p0->color.v[2])*t; +} + +/* + * Line Clipping + */ + +/* Line Clipping algorithm from 'Computer Graphics', Principles and + Practice */ +static inline int ClipLine1(float denom,float num,float *tmin,float *tmax) +{ + float t; + + if (denom>0) { + t=num/denom; + if (t>*tmax) return 0; + if (t>*tmin) *tmin=t; + } else if (denom<0) { + t=num/denom; + if (t<*tmin) return 0; + if (t<*tmax) *tmax=t; + } else if (num>0) return 0; + return 1; +} + +void gl_draw_line(GLContext *c,GLVertex *p1,GLVertex *p2) +{ + float dx,dy,dz,dw,x1,y1,z1,w1; + float tmin,tmax; + GLVertex q1,q2; + int cc1,cc2; + + cc1=p1->clip_code; + cc2=p2->clip_code; + + if ( (cc1 | cc2) == 0) { + if (c->render_mode == GL_SELECT) { + gl_add_select1(c,p1->zp.z,p2->zp.z,p2->zp.z); + } else { + if (c->depth_test) + ZB_line_z(c->zb,&p1->zp,&p2->zp); + else + ZB_line(c->zb,&p1->zp,&p2->zp); + } + } else if ( (cc1&cc2) != 0 ) { + return; + } else { + dx=p2->pc.X-p1->pc.X; + dy=p2->pc.Y-p1->pc.Y; + dz=p2->pc.Z-p1->pc.Z; + dw=p2->pc.W-p1->pc.W; + x1=p1->pc.X; + y1=p1->pc.Y; + z1=p1->pc.Z; + w1=p1->pc.W; + + tmin=0; + tmax=1; + if (ClipLine1(dx+dw,-x1-w1,&tmin,&tmax) && + ClipLine1(-dx+dw,x1-w1,&tmin,&tmax) && + ClipLine1(dy+dw,-y1-w1,&tmin,&tmax) && + ClipLine1(-dy+dw,y1-w1,&tmin,&tmax) && + ClipLine1(dz+dw,-z1-w1,&tmin,&tmax) && + ClipLine1(-dz+dw,z1-w1,&tmin,&tmax)) { + + interpolate(&q1,p1,p2,tmin); + interpolate(&q2,p1,p2,tmax); + gl_transform_to_viewport(c,&q1); + gl_transform_to_viewport(c,&q2); + + RGBFtoRGBI(q1.color.v[0],q1.color.v[1],q1.color.v[2],q1.zp.r,q1.zp.g,q1.zp.b); + RGBFtoRGBI(q2.color.v[0],q2.color.v[1],q2.color.v[2],q2.zp.r,q2.zp.g,q2.zp.b); + + if (c->depth_test) + ZB_line_z(c->zb,&q1.zp,&q2.zp); + else + ZB_line(c->zb,&q1.zp,&q2.zp); + } + } +} + + +/* triangle */ + +/* + * Clipping + */ + +/* We clip the segment [a,b] against the 6 planes of the normal volume. + * We compute the point 'c' of intersection and the value of the parameter 't' + * of the intersection if x=a+t(b-a). + */ + +#define clip_func(name,sign,dir,dir1,dir2) \ +static float name(V4 *c,V4 *a,V4 *b) \ +{\ + float t,dX,dY,dZ,dW,den;\ + dX = (b->X - a->X);\ + dY = (b->Y - a->Y);\ + dZ = (b->Z - a->Z);\ + dW = (b->W - a->W);\ + den = -(sign d ## dir) + dW;\ + if (den == 0) t=0;\ + else t = ( sign a->dir - a->W) / den;\ + c->dir1 = a->dir1 + t * d ## dir1;\ + c->dir2 = a->dir2 + t * d ## dir2;\ + c->W = a->W + t * dW;\ + c->dir = sign c->W;\ + return t;\ +} + + +clip_func(clip_xmin,-,X,Y,Z) + +clip_func(clip_xmax,+,X,Y,Z) + +clip_func(clip_ymin,-,Y,X,Z) + +clip_func(clip_ymax,+,Y,X,Z) + +clip_func(clip_zmin,-,Z,X,Y) + +clip_func(clip_zmax,+,Z,X,Y) + + +float (*clip_proc[6])(V4 *,V4 *,V4 *)= { + clip_xmin,clip_xmax, + clip_ymin,clip_ymax, + clip_zmin,clip_zmax +}; + +static inline void updateTmp(GLContext *c, + GLVertex *q,GLVertex *p0,GLVertex *p1,float t) +{ + if (c->current_shade_model == GL_SMOOTH) { + q->color.v[0]=p0->color.v[0] + (p1->color.v[0]-p0->color.v[0])*t; + q->color.v[1]=p0->color.v[1] + (p1->color.v[1]-p0->color.v[1])*t; + q->color.v[2]=p0->color.v[2] + (p1->color.v[2]-p0->color.v[2])*t; + } else { + q->color.v[0]=p0->color.v[0]; + q->color.v[1]=p0->color.v[1]; + q->color.v[2]=p0->color.v[2]; + } + + if (c->texture_2d_enabled) { + q->tex_coord.X=p0->tex_coord.X + (p1->tex_coord.X-p0->tex_coord.X)*t; + q->tex_coord.Y=p0->tex_coord.Y + (p1->tex_coord.Y-p0->tex_coord.Y)*t; + } + + q->clip_code=gl_clipcode(q->pc.X,q->pc.Y,q->pc.Z,q->pc.W); + if (q->clip_code==0){ + gl_transform_to_viewport(c,q); + RGBFtoRGBI(q->color.v[0],q->color.v[1],q->color.v[2],q->zp.r,q->zp.g,q->zp.b); + } +} + +static void gl_draw_triangle_clip(GLContext *c, + GLVertex *p0,GLVertex *p1,GLVertex *p2,int clip_bit); + +void gl_draw_triangle(GLContext *c, + GLVertex *p0,GLVertex *p1,GLVertex *p2) +{ + int co,c_and,cc[3],front; + float norm; + + cc[0]=p0->clip_code; + cc[1]=p1->clip_code; + cc[2]=p2->clip_code; + + co=cc[0] | cc[1] | cc[2]; + + /* we handle the non clipped case here to go faster */ + if (co==0) { + + norm=(float)(p1->zp.x-p0->zp.x)*(float)(p2->zp.y-p0->zp.y)- + (float)(p2->zp.x-p0->zp.x)*(float)(p1->zp.y-p0->zp.y); + + if (norm == 0) return; + + front = norm < 0.0; + front = front ^ c->current_front_face; + + /* back face culling */ + if (c->cull_face_enabled) { + /* most used case first */ + if (c->current_cull_face == GL_BACK) { + if (front == 0) return; + c->draw_triangle_front(c,p0,p1,p2); + } else if (c->current_cull_face == GL_FRONT) { + if (front != 0) return; + c->draw_triangle_back(c,p0,p1,p2); + } else { + return; + } + } else { + /* no culling */ + if (front) { + c->draw_triangle_front(c,p0,p1,p2); + } else { + c->draw_triangle_back(c,p0,p1,p2); + } + } + } else { + c_and=cc[0] & cc[1] & cc[2]; + if (c_and==0) { + gl_draw_triangle_clip(c,p0,p1,p2,0); + } + } +} + +static void gl_draw_triangle_clip(GLContext *c, + GLVertex *p0,GLVertex *p1,GLVertex *p2,int clip_bit) +{ + int co,c_and,co1,cc[3],edge_flag_tmp,clip_mask; + GLVertex tmp1,tmp2,*q[3]; + float tt; + + cc[0]=p0->clip_code; + cc[1]=p1->clip_code; + cc[2]=p2->clip_code; + + co=cc[0] | cc[1] | cc[2]; + if (co == 0) { + gl_draw_triangle(c,p0,p1,p2); + } else { + c_and=cc[0] & cc[1] & cc[2]; + /* the triangle is completely outside */ + if (c_and!=0) return; + + /* find the next direction to clip */ + while (clip_bit < 6 && (co & (1 << clip_bit)) == 0) { + clip_bit++; + } + + /* this test can be true only in case of rounding errors */ + if (clip_bit == 6) { +#if 0 + printf("Error:\n"); + printf("%f %f %f %f\n",p0->pc.X,p0->pc.Y,p0->pc.Z,p0->pc.W); + printf("%f %f %f %f\n",p1->pc.X,p1->pc.Y,p1->pc.Z,p1->pc.W); + printf("%f %f %f %f\n",p2->pc.X,p2->pc.Y,p2->pc.Z,p2->pc.W); +#endif + return; + } + + clip_mask = 1 << clip_bit; + co1=(cc[0] ^ cc[1] ^ cc[2]) & clip_mask; + + if (co1) { + /* one point outside */ + + if (cc[0] & clip_mask) { q[0]=p0; q[1]=p1; q[2]=p2; } + else if (cc[1] & clip_mask) { q[0]=p1; q[1]=p2; q[2]=p0; } + else { q[0]=p2; q[1]=p0; q[2]=p1; } + + tt=clip_proc[clip_bit](&tmp1.pc,&q[0]->pc,&q[1]->pc); + updateTmp(c,&tmp1,q[0],q[1],tt); + + tt=clip_proc[clip_bit](&tmp2.pc,&q[0]->pc,&q[2]->pc); + updateTmp(c,&tmp2,q[0],q[2],tt); + + tmp1.edge_flag=q[0]->edge_flag; + edge_flag_tmp=q[2]->edge_flag; + q[2]->edge_flag=0; + gl_draw_triangle_clip(c,&tmp1,q[1],q[2],clip_bit+1); + + tmp2.edge_flag=0; + tmp1.edge_flag=0; + q[2]->edge_flag=edge_flag_tmp; + gl_draw_triangle_clip(c,&tmp2,&tmp1,q[2],clip_bit+1); + } else { + /* two points outside */ + + if ((cc[0] & clip_mask)==0) { q[0]=p0; q[1]=p1; q[2]=p2; } + else if ((cc[1] & clip_mask)==0) { q[0]=p1; q[1]=p2; q[2]=p0; } + else { q[0]=p2; q[1]=p0; q[2]=p1; } + + tt=clip_proc[clip_bit](&tmp1.pc,&q[0]->pc,&q[1]->pc); + updateTmp(c,&tmp1,q[0],q[1],tt); + + tt=clip_proc[clip_bit](&tmp2.pc,&q[0]->pc,&q[2]->pc); + updateTmp(c,&tmp2,q[0],q[2],tt); + + tmp1.edge_flag=1; + tmp2.edge_flag=q[2]->edge_flag; + gl_draw_triangle_clip(c,q[0],&tmp1,&tmp2,clip_bit+1); + } + } +} + + +void gl_draw_triangle_select(GLContext *c, + GLVertex *p0,GLVertex *p1,GLVertex *p2) +{ + gl_add_select1(c,p0->zp.z,p1->zp.z,p2->zp.z); +} + +#ifdef PROFILE +int count_triangles,count_triangles_textured,count_pixels; +#endif + +void gl_draw_triangle_fill(GLContext *c, + GLVertex *p0,GLVertex *p1,GLVertex *p2) +{ +#ifdef PROFILE + { + int norm; + assert(p0->zp.x >= 0 && p0->zp.x < c->zb->xsize); + assert(p0->zp.y >= 0 && p0->zp.y < c->zb->ysize); + assert(p1->zp.x >= 0 && p1->zp.x < c->zb->xsize); + assert(p1->zp.y >= 0 && p1->zp.y < c->zb->ysize); + assert(p2->zp.x >= 0 && p2->zp.x < c->zb->xsize); + assert(p2->zp.y >= 0 && p2->zp.y < c->zb->ysize); + + norm=(p1->zp.x-p0->zp.x)*(p2->zp.y-p0->zp.y)- + (p2->zp.x-p0->zp.x)*(p1->zp.y-p0->zp.y); + count_pixels+=abs(norm)/2; + count_triangles++; + } +#endif + + if (c->texture_2d_enabled) { +#ifdef PROFILE + count_triangles_textured++; +#endif + ZB_setTexture(c->zb,c->current_texture->images[0].pixmap); + ZB_fillTriangleMappingPerspective(c->zb,&p0->zp,&p1->zp,&p2->zp); + } else if (c->current_shade_model == GL_SMOOTH) { + ZB_fillTriangleSmooth(c->zb,&p0->zp,&p1->zp,&p2->zp); + } else { + ZB_fillTriangleFlat(c->zb,&p0->zp,&p1->zp,&p2->zp); + } +} + +/* Render a clipped triangle in line mode */ + +void gl_draw_triangle_line(GLContext *c, + GLVertex *p0,GLVertex *p1,GLVertex *p2) +{ + if (c->depth_test) { + if (p0->edge_flag) ZB_line_z(c->zb,&p0->zp,&p1->zp); + if (p1->edge_flag) ZB_line_z(c->zb,&p1->zp,&p2->zp); + if (p2->edge_flag) ZB_line_z(c->zb,&p2->zp,&p0->zp); + } else { + if (p0->edge_flag) ZB_line(c->zb,&p0->zp,&p1->zp); + if (p1->edge_flag) ZB_line(c->zb,&p1->zp,&p2->zp); + if (p2->edge_flag) ZB_line(c->zb,&p2->zp,&p0->zp); + } +} + + + +/* Render a clipped triangle in point mode */ +void gl_draw_triangle_point(GLContext *c, + GLVertex *p0,GLVertex *p1,GLVertex *p2) +{ + if (p0->edge_flag) ZB_plot(c->zb,&p0->zp); + if (p1->edge_flag) ZB_plot(c->zb,&p1->zp); + if (p2->edge_flag) ZB_plot(c->zb,&p2->zp); +} + + + + diff --git a/programs/develop/libraries/TinyGL/src/error.c b/programs/develop/libraries/TinyGL/src/error.c new file mode 100644 index 0000000000..1e1a566681 --- /dev/null +++ b/programs/develop/libraries/TinyGL/src/error.c @@ -0,0 +1,16 @@ +#include +#include "zgl.h" + +void gl_fatal_error(char *format, ...) +{ + va_list ap; + + va_start(ap,format); + + fprintf(stderr,"TinyGL: fatal error: "); + vfprintf(stderr,format,ap); + fprintf(stderr,"\n"); + exit(1); + + va_end(ap); +} diff --git a/programs/develop/libraries/TinyGL/src/get.c b/programs/develop/libraries/TinyGL/src/get.c new file mode 100644 index 0000000000..4b16aa1776 --- /dev/null +++ b/programs/develop/libraries/TinyGL/src/get.c @@ -0,0 +1,72 @@ +#include "zgl.h" + +void glGetIntegerv(int pname,int *params) +{ + GLContext *c=gl_get_context(); + + switch(pname) { + case GL_VIEWPORT: + params[0]=c->viewport.xmin; + params[1]=c->viewport.ymin; + params[2]=c->viewport.xsize; + params[3]=c->viewport.ysize; + break; + case GL_MAX_MODELVIEW_STACK_DEPTH: + *params = MAX_MODELVIEW_STACK_DEPTH; + break; + case GL_MAX_PROJECTION_STACK_DEPTH: + *params = MAX_PROJECTION_STACK_DEPTH; + break; + case GL_MAX_LIGHTS: + *params = MAX_LIGHTS; + break; + case GL_MAX_TEXTURE_SIZE: + *params = 256; /* not completely true, but... */ + break; + case GL_MAX_TEXTURE_STACK_DEPTH: + *params = MAX_TEXTURE_STACK_DEPTH; + break; + default: + gl_fatal_error("glGet: option not implemented"); + break; + } +} + +void glGetFloatv(int pname, float *v) +{ + int i; + int mnr = 0; /* just a trick to return the correct matrix */ + GLContext *c = gl_get_context(); + switch (pname) { + case GL_TEXTURE_MATRIX: + mnr++; + case GL_PROJECTION_MATRIX: + mnr++; + case GL_MODELVIEW_MATRIX: + { + float *p = &c->matrix_stack_ptr[mnr]->m[0][0];; + for (i = 0; i < 4; i++) { + *v++ = p[0]; + *v++ = p[4]; + *v++ = p[8]; + *v++ = p[12]; + p++; + } + } + break; + case GL_LINE_WIDTH: + *v = 1.0f; + break; + case GL_LINE_WIDTH_RANGE: + v[0] = v[1] = 1.0f; + break; + case GL_POINT_SIZE: + *v = 1.0f; + break; + case GL_POINT_SIZE_RANGE: + v[0] = v[1] = 1.0f; + default: + fprintf(stderr,"warning: unknown pname in glGetFloatv()\n"); + break; + } +} diff --git a/programs/develop/libraries/TinyGL/src/glu.c b/programs/develop/libraries/TinyGL/src/glu.c new file mode 100644 index 0000000000..59557cf13d --- /dev/null +++ b/programs/develop/libraries/TinyGL/src/glu.c @@ -0,0 +1,343 @@ +#include +#include +#include +#include + + +void drawTorus(float rc, int numc, float rt, int numt) +{ + int i, j, k; + double s, t; + double x, y, z; + double pi, twopi; + + pi = 3.14159265358979323846; + twopi = 2 * pi; + + for (i = 0; i < numc; i++) { + glBegin(GL_QUAD_STRIP); + for (j = 0; j <= numt; j++) { + for (k = 1; k >= 0; k--) { + s = (i + k) % numc + 0.5; + t = j % numt; + + x = cos(t*twopi/numt) * cos(s*twopi/numc); + y = sin(t*twopi/numt) * cos(s*twopi/numc); + z = sin(s*twopi/numc); + glNormal3f(x, y, z); + + x = (rt + rc * cos(s*twopi/numc)) * cos(t*twopi/numt); + y = (rt + rc * cos(s*twopi/numc)) * sin(t*twopi/numt); + z = rc * sin(s*twopi/numc); + glVertex3f(x, y, z); + } + } + glEnd(); + } +} + +static void normal3f( GLfloat x, GLfloat y, GLfloat z ) +{ + GLdouble mag; + + mag = sqrt( x*x + y*y + z*z ); + if (mag>0.00001F) { + x /= mag; + y /= mag; + z /= mag; + } + glNormal3f( x, y, z ); +} + +void gluPerspective( GLdouble fovy, GLdouble aspect, + GLdouble zNear, GLdouble zFar ) +{ + GLdouble xmin, xmax, ymin, ymax; + + ymax = zNear * tan( fovy * M_PI / 360.0 ); + ymin = -ymax; + + xmin = ymin * aspect; + xmax = ymax * aspect; + + glFrustum( xmin, xmax, ymin, ymax, zNear, zFar ); + +} + +void +gluLookAt(GLdouble eyex, GLdouble eyey, GLdouble eyez, + GLdouble centerx, GLdouble centery, GLdouble centerz, + GLdouble upx, GLdouble upy, GLdouble upz) +{ + GLfloat m[16]; + GLdouble x[3], y[3], z[3]; + GLdouble mag; + + /* Make rotation matrix */ + + /* Z vector */ + z[0] = eyex - centerx; + z[1] = eyey - centery; + z[2] = eyez - centerz; + mag = sqrt(z[0] * z[0] + z[1] * z[1] + z[2] * z[2]); + if (mag) { /* mpichler, 19950515 */ + z[0] /= mag; + z[1] /= mag; + z[2] /= mag; + } + + /* Y vector */ + y[0] = upx; + y[1] = upy; + y[2] = upz; + + /* X vector = Y cross Z */ + x[0] = y[1] * z[2] - y[2] * z[1]; + x[1] = -y[0] * z[2] + y[2] * z[0]; + x[2] = y[0] * z[1] - y[1] * z[0]; + + /* Recompute Y = Z cross X */ + y[0] = z[1] * x[2] - z[2] * x[1]; + y[1] = -z[0] * x[2] + z[2] * x[0]; + y[2] = z[0] * x[1] - z[1] * x[0]; + + /* mpichler, 19950515 */ + /* cross product gives area of parallelogram, which is < 1.0 for + * non-perpendicular unit-length vectors; so normalize x, y here + */ + + mag = sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]); + if (mag) { + x[0] /= mag; + x[1] /= mag; + x[2] /= mag; + } + + mag = sqrt(y[0] * y[0] + y[1] * y[1] + y[2] * y[2]); + if (mag) { + y[0] /= mag; + y[1] /= mag; + y[2] /= mag; + } + +#define M(row,col) m[col*4+row] + M(0, 0) = x[0]; + M(0, 1) = x[1]; + M(0, 2) = x[2]; + M(0, 3) = 0.0; + M(1, 0) = y[0]; + M(1, 1) = y[1]; + M(1, 2) = y[2]; + M(1, 3) = 0.0; + M(2, 0) = z[0]; + M(2, 1) = z[1]; + M(2, 2) = z[2]; + M(2, 3) = 0.0; + M(3, 0) = 0.0; + M(3, 1) = 0.0; + M(3, 2) = 0.0; + M(3, 3) = 1.0; +#undef M + glMultMatrixf(m); + + /* Translate Eye to Origin */ + glTranslatef(-eyex, -eyey, -eyez); + +} + +GLUquadricObj *gluNewQuadric(void) +{ + return NULL; +} + +void gluQuadricDrawStyle(GLUquadricObj *obj, int style) +{ +} + +void gluCylinder( GLUquadricObj *qobj, + GLdouble baseRadius, GLdouble topRadius, GLdouble height, + GLint slices, GLint stacks ) +{ + GLdouble da, r, dr, dz; + GLfloat z, nz, nsign; + GLint i, j; + GLfloat du = 1.0 / slices; + GLfloat dv = 1.0 / stacks; + GLfloat tcx = 0.0, tcy = 0.0; + + nsign = 1.0; + + da = 2.0*M_PI / slices; + dr = (topRadius-baseRadius) / stacks; + dz = height / stacks; + nz = (baseRadius-topRadius) / height; /* Z component of normal vectors */ + + for (i=0;i=0;j--) { + theta = (j==slices) ? 0.0 : j * dtheta; + x = -sin(theta) * sin(rho); + y = cos(theta) * sin(rho); + z = nsign * cos(rho); + if (normals) glNormal3f( x*nsign, y*nsign, z*nsign ); + glTexCoord2f(s,1-t); + s -= ds; + glVertex3f( x*radius, y*radius, z*radius ); + } + glEnd(); +} diff --git a/programs/develop/libraries/TinyGL/src/image_util.c b/programs/develop/libraries/TinyGL/src/image_util.c new file mode 100644 index 0000000000..2789a55c6f --- /dev/null +++ b/programs/develop/libraries/TinyGL/src/image_util.c @@ -0,0 +1,136 @@ +#include "zgl.h" + +/* + * image conversion + */ + +void gl_convertRGB_to_5R6G5B(unsigned short *pixmap,unsigned char *rgb, + int xsize,int ysize) +{ + int i,n; + unsigned char *p; + + p=rgb; + n=xsize*ysize; + for(i=0;i>3); + p+=3; + } +} + +void gl_convertRGB_to_8A8R8G8B(unsigned int *pixmap, unsigned char *rgb, + int xsize, int ysize) +{ + int i,n; + unsigned char *p; + + p=rgb; + n=xsize*ysize; + for(i=0;i> INTERP_NORM_BITS); +} + + +/* + * TODO: more accurate resampling + */ + +void gl_resizeImage(unsigned char *dest,int xsize_dest,int ysize_dest, + unsigned char *src,int xsize_src,int ysize_src) +{ + unsigned char *pix,*pix_src; + float x1,y1,x1inc,y1inc; + int xi,yi,j,xf,yf,x,y; + + pix=dest; + pix_src=src; + + x1inc=(float) (xsize_src - 1) / (float) (xsize_dest - 1); + y1inc=(float) (ysize_src - 1) / (float) (ysize_dest - 1); + + y1=0; + for(y=0;y> FRAC_BITS; + yi=y1 >> FRAC_BITS; + pix1=pix_src+(yi*xsize_src+xi)*3; + + pix[0]=pix1[0]; + pix[1]=pix1[1]; + pix[2]=pix1[2]; + + pix+=3; + x1+=x1inc; + } + y1+=y1inc; + } +} + diff --git a/programs/develop/libraries/TinyGL/src/init.c b/programs/develop/libraries/TinyGL/src/init.c new file mode 100644 index 0000000000..edc7a4c371 --- /dev/null +++ b/programs/develop/libraries/TinyGL/src/init.c @@ -0,0 +1,189 @@ +#include "zgl.h" + +GLContext *gl_ctx; + + +void initSharedState(GLContext *c) +{ + GLSharedState *s=&c->shared_state; + s->lists=gl_zalloc(sizeof(GLList *) * MAX_DISPLAY_LISTS); + s->texture_hash_table= + gl_zalloc(sizeof(GLTexture *) * TEXTURE_HASH_TABLE_SIZE); + + alloc_texture(c,0); +} + +void endSharedState(GLContext *c) +{ + GLSharedState *s=&c->shared_state; + int i; + + for(i=0;ilists); + + gl_free(s->texture_hash_table); +} + + +void glInit(void *zbuffer1) +{ + ZBuffer *zbuffer=(ZBuffer *)zbuffer1; + GLContext *c; + GLViewport *v; + int i; + + c=gl_zalloc(sizeof(GLContext)); + gl_ctx=c; + + c->zb=zbuffer; + + /* allocate GLVertex array */ + c->vertex_max = POLYGON_MAX_VERTEX; + c->vertex = gl_malloc(POLYGON_MAX_VERTEX*sizeof(GLVertex)); + + /* viewport */ + v=&c->viewport; + v->xmin=0; + v->ymin=0; + v->xsize=zbuffer->xsize; + v->ysize=zbuffer->ysize; + v->updated=1; + + /* shared state */ + initSharedState(c); + + /* lists */ + + c->exec_flag=1; + c->compile_flag=0; + c->print_flag=0; + + c->in_begin=0; + + /* lights */ + for(i=0;ilights[i]; + l->ambient=gl_V4_New(0,0,0,1); + l->diffuse=gl_V4_New(1,1,1,1); + l->specular=gl_V4_New(1,1,1,1); + l->position=gl_V4_New(0,0,1,0); + l->norm_position=gl_V3_New(0,0,1); + l->spot_direction=gl_V3_New(0,0,-1); + l->norm_spot_direction=gl_V3_New(0,0,-1); + l->spot_exponent=0; + l->spot_cutoff=180; + l->attenuation[0]=1; + l->attenuation[1]=0; + l->attenuation[2]=0; + l->enabled=0; + } + c->first_light=NULL; + c->ambient_light_model=gl_V4_New(0.2,0.2,0.2,1); + c->local_light_model=0; + c->lighting_enabled=0; + c->light_model_two_side = 0; + + /* default materials */ + for(i=0;i<2;i++) { + GLMaterial *m=&c->materials[i]; + m->emission=gl_V4_New(0,0,0,1); + m->ambient=gl_V4_New(0.2,0.2,0.2,1); + m->diffuse=gl_V4_New(0.8,0.8,0.8,1); + m->specular=gl_V4_New(0,0,0,1); + m->shininess=0; + } + c->current_color_material_mode=GL_FRONT_AND_BACK; + c->current_color_material_type=GL_AMBIENT_AND_DIFFUSE; + c->color_material_enabled=0; + + /* textures */ + glInitTextures(c); + + /* default state */ + c->current_color.X=1.0; + c->current_color.Y=1.0; + c->current_color.Z=1.0; + c->current_color.W=1.0; + c->longcurrent_color[0] = 65535; + c->longcurrent_color[1] = 65535; + c->longcurrent_color[2] = 65535; + + c->current_normal.X=1.0; + c->current_normal.Y=0.0; + c->current_normal.Z=0.0; + c->current_normal.W=0.0; + + c->current_edge_flag=1; + + c->current_tex_coord.X=0; + c->current_tex_coord.Y=0; + c->current_tex_coord.Z=0; + c->current_tex_coord.W=1; + + c->polygon_mode_front=GL_FILL; + c->polygon_mode_back=GL_FILL; + + c->current_front_face=0; /* 0 = GL_CCW 1 = GL_CW */ + c->current_cull_face=GL_BACK; + c->current_shade_model=GL_SMOOTH; + c->cull_face_enabled=0; + + /* clear */ + c->clear_color.v[0]=0; + c->clear_color.v[1]=0; + c->clear_color.v[2]=0; + c->clear_color.v[3]=0; + c->clear_depth=0; + + /* selection */ + c->render_mode=GL_RENDER; + c->select_buffer=NULL; + c->name_stack_size=0; + + /* matrix */ + c->matrix_mode=0; + + c->matrix_stack_depth_max[0]=MAX_MODELVIEW_STACK_DEPTH; + c->matrix_stack_depth_max[1]=MAX_PROJECTION_STACK_DEPTH; + c->matrix_stack_depth_max[2]=MAX_TEXTURE_STACK_DEPTH; + + for(i=0;i<3;i++) { + c->matrix_stack[i]=gl_zalloc(c->matrix_stack_depth_max[i] * sizeof(M4)); + c->matrix_stack_ptr[i]=c->matrix_stack[i]; + } + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glMatrixMode(GL_TEXTURE); + glLoadIdentity(); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + c->matrix_model_projection_updated=1; + + /* opengl 1.1 arrays */ + c->client_states = 0; + + /* opengl 1.1 polygon offset */ + c->offset_states = 0; + + /* clear the resize callback function pointer */ + c->gl_resize_viewport = NULL; + + /* specular buffer */ + c->specbuf_first = NULL; + c->specbuf_used_counter = 0; + c->specbuf_num_buffers = 0; + + /* depth test */ + c->depth_test = 0; +} + +void glClose(void) +{ + GLContext *c=gl_get_context(); + endSharedState(c); + gl_free(c); +} diff --git a/programs/develop/libraries/TinyGL/src/kosgl.c b/programs/develop/libraries/TinyGL/src/kosgl.c new file mode 100644 index 0000000000..862db2a3cd --- /dev/null +++ b/programs/develop/libraries/TinyGL/src/kosgl.c @@ -0,0 +1,127 @@ +/* simple gl like driver for TinyGL and KolibriOS - porting iadn */ +#include +#include "kosgl.h" +#include "zgl.h" + + + +typedef struct { + GLContext *gl_context; + int xsize,ysize; + int dx,dy; + int x,y; +} TinyGLContext; + + +KOSGLContext kosglCreateContext(KOSGLContext shareList, int flags) +{ + TinyGLContext *ctx; + + if (shareList != NULL) { + gl_fatal_error("No sharing available in TinyGL"); + } + + ctx=gl_malloc(sizeof(TinyGLContext)); + if (!ctx) + return NULL; + ctx->gl_context=NULL; + return (KOSGLContext) ctx; +} + +void kosglDestroyContext( KOSGLContext ctx1 ) +{ + TinyGLContext *ctx = (TinyGLContext *) ctx1; + if (ctx->gl_context != NULL) { + glClose(); + } + gl_free(ctx); +} + +/* resize the glx viewport : we try to use the xsize and ysize + given. We return the effective size which is guaranted to be smaller */ + +static int gl_resize_viewport(GLContext *c,int *xsize_ptr,int *ysize_ptr) +{ + TinyGLContext *ctx; + int xsize,ysize; + + ctx=(TinyGLContext *)c->opaque; + + xsize=*xsize_ptr; + ysize=*ysize_ptr; + + /* we ensure that xsize and ysize are multiples of 2 for the zbuffer. + TODO: find a better solution */ + xsize&=~3; + ysize&=~3; + + if (xsize == 0 || ysize == 0) return -1; + + *xsize_ptr=xsize-1; + *ysize_ptr=ysize-1; + ctx->dx = xsize; + ctx->dy = ysize; + + ctx->xsize=xsize; + ctx->ysize=ysize; + + /* resize the Z buffer */ + ZB_resize(c->zb,NULL,xsize,ysize); + return 0; +} + +/* we assume here that drawable is a window */ +int kosglMakeCurrent( int win_x0, int win_y0,int win_x, int win_y, KOSGLContext ctx1) +{ + TinyGLContext *ctx = (TinyGLContext *) ctx1; + int mode; + ZBuffer *zb; + + if (ctx->gl_context == NULL) { + /* create the TinyGL context */ + ctx->x = win_x0; + ctx->y = win_y0; + ctx->dx = win_x; + ctx->dy = win_y; + + /* currently, we only support 16 bit rendering */ + mode = ZB_MODE_RGB24; + zb=ZB_open(win_x,win_y,mode,0,NULL,NULL,NULL); + + if (zb == NULL) { + fprintf(stderr, "Error while initializing Z buffer\n"); + exit(1); + } + + /* initialisation of the TinyGL interpreter */ + glInit(zb); + + ctx->gl_context=gl_get_context(); + + ctx->gl_context->opaque=(void *) ctx; + ctx->gl_context->gl_resize_viewport=gl_resize_viewport; + + /* set the viewport : we force a call to gl_resize_viewport */ + ctx->gl_context->viewport.xsize=-1; + ctx->gl_context->viewport.ysize=-1; + + glViewport(0, 0, win_x, win_y); + + } + return 1; +} + +void kosglSwapBuffers( ) +{ + GLContext *gl_context; + TinyGLContext *ctx; + + /* retrieve the current TinyGLContext */ + gl_context=gl_get_context(); + ctx=(TinyGLContext *)gl_context->opaque; + + __asm__ __volatile__("int $0x40"::"a"(7), + "b"((char *)gl_context->zb->pbuf), + "c"((ctx->dx<<16)|ctx->dy), + "d"((ctx->x<<16)|ctx->y)); +} diff --git a/programs/develop/libraries/TinyGL/src/light.c b/programs/develop/libraries/TinyGL/src/light.c new file mode 100644 index 0000000000..36c368143a --- /dev/null +++ b/programs/develop/libraries/TinyGL/src/light.c @@ -0,0 +1,306 @@ +#include "zgl.h" +#include "msghandling.h" + +void glopMaterial(GLContext *c,GLParam *p) +{ + int mode=p[1].i; + int type=p[2].i; + float *v=&p[3].f; + int i; + GLMaterial *m; + + if (mode == GL_FRONT_AND_BACK) { + p[1].i=GL_FRONT; + glopMaterial(c,p); + mode=GL_BACK; + } + if (mode == GL_FRONT) m=&c->materials[0]; + else m=&c->materials[1]; + + switch(type) { + case GL_EMISSION: + for(i=0;i<4;i++) + m->emission.v[i]=v[i]; + break; + case GL_AMBIENT: + for(i=0;i<4;i++) + m->ambient.v[i]=v[i]; + break; + case GL_DIFFUSE: + for(i=0;i<4;i++) + m->diffuse.v[i]=v[i]; + break; + case GL_SPECULAR: + for(i=0;i<4;i++) + m->specular.v[i]=v[i]; + break; + case GL_SHININESS: + m->shininess=v[0]; + m->shininess_i = (v[0]/128.0f)*SPECULAR_BUFFER_RESOLUTION; + break; + case GL_AMBIENT_AND_DIFFUSE: + for(i=0;i<4;i++) + m->diffuse.v[i]=v[i]; + for(i=0;i<4;i++) + m->ambient.v[i]=v[i]; + break; + default: + assert(0); + } +} + +void glopColorMaterial(GLContext *c,GLParam *p) +{ + int mode=p[1].i; + int type=p[2].i; + + c->current_color_material_mode=mode; + c->current_color_material_type=type; +} + +void glopLight(GLContext *c,GLParam *p) +{ + int light=p[1].i; + int type=p[2].i; + V4 v; + GLLight *l; + int i; + + assert(light >= GL_LIGHT0 && light < GL_LIGHT0+MAX_LIGHTS ); + + l=&c->lights[light-GL_LIGHT0]; + + for(i=0;i<4;i++) v.v[i]=p[3+i].f; + + switch(type) { + case GL_AMBIENT: + l->ambient=v; + break; + case GL_DIFFUSE: + l->diffuse=v; + break; + case GL_SPECULAR: + l->specular=v; + break; + case GL_POSITION: + { + V4 pos; + gl_M4_MulV4(&pos,c->matrix_stack_ptr[0],&v); + + l->position=pos; + + if (l->position.v[3] == 0) { + l->norm_position.X=pos.X; + l->norm_position.Y=pos.Y; + l->norm_position.Z=pos.Z; + + gl_V3_Norm(&l->norm_position); + } + } + break; + case GL_SPOT_DIRECTION: + for(i=0;i<3;i++) { + l->spot_direction.v[i]=v.v[i]; + l->norm_spot_direction.v[i]=v.v[i]; + } + gl_V3_Norm(&l->norm_spot_direction); + break; + case GL_SPOT_EXPONENT: + l->spot_exponent=v.v[0]; + break; + case GL_SPOT_CUTOFF: + { + float a=v.v[0]; + assert(a == 180 || (a>=0 && a<=90)); + l->spot_cutoff=a; + if (a != 180) l->cos_spot_cutoff=cos(a * M_PI / 180.0); + } + break; + case GL_CONSTANT_ATTENUATION: + l->attenuation[0]=v.v[0]; + break; + case GL_LINEAR_ATTENUATION: + l->attenuation[1]=v.v[0]; + break; + case GL_QUADRATIC_ATTENUATION: + l->attenuation[2]=v.v[0]; + break; + default: + assert(0); + } +} + + +void glopLightModel(GLContext *c,GLParam *p) +{ + int pname=p[1].i; + float *v=&p[2].f; + int i; + + switch(pname) { + case GL_LIGHT_MODEL_AMBIENT: + for(i=0;i<4;i++) + c->ambient_light_model.v[i]=v[i]; + break; + case GL_LIGHT_MODEL_LOCAL_VIEWER: + c->local_light_model=(int)v[0]; + break; + case GL_LIGHT_MODEL_TWO_SIDE: + c->light_model_two_side = (int)v[0]; + break; + default: + tgl_warning("glopLightModel: illegal pname: 0x%x\n", pname); + //assert(0); + break; + } +} + + +static inline float clampf(float a,float min,float max) +{ + if (amax) return max; + else return a; +} + +void gl_enable_disable_light(GLContext *c,int light,int v) +{ + GLLight *l=&c->lights[light]; + if (v && !l->enabled) { + l->enabled=1; + l->next=c->first_light; + c->first_light=l; + l->prev=NULL; + } else if (!v && l->enabled) { + l->enabled=0; + if (l->prev == NULL) c->first_light=l->next; + else l->prev->next=l->next; + if (l->next != NULL) l->next->prev=l->prev; + } +} + +/* non optimized lightening model */ +void gl_shade_vertex(GLContext *c,GLVertex *v) +{ + float R,G,B,A; + GLMaterial *m; + GLLight *l; + V3 n,s,d; + float dist,tmp,att,dot,dot_spot,dot_spec; + int twoside = c->light_model_two_side; + + m=&c->materials[0]; + + n.X=v->normal.X; + n.Y=v->normal.Y; + n.Z=v->normal.Z; + + R=m->emission.v[0]+m->ambient.v[0]*c->ambient_light_model.v[0]; + G=m->emission.v[1]+m->ambient.v[1]*c->ambient_light_model.v[1]; + B=m->emission.v[2]+m->ambient.v[2]*c->ambient_light_model.v[2]; + A=clampf(m->diffuse.v[3],0,1); + + for(l=c->first_light;l!=NULL;l=l->next) { + float lR,lB,lG; + + /* ambient */ + lR=l->ambient.v[0] * m->ambient.v[0]; + lG=l->ambient.v[1] * m->ambient.v[1]; + lB=l->ambient.v[2] * m->ambient.v[2]; + + if (l->position.v[3] == 0) { + /* light at infinity */ + d.X=l->position.v[0]; + d.Y=l->position.v[1]; + d.Z=l->position.v[2]; + att=1; + } else { + /* distance attenuation */ + d.X=l->position.v[0]-v->ec.v[0]; + d.Y=l->position.v[1]-v->ec.v[1]; + d.Z=l->position.v[2]-v->ec.v[2]; + dist=sqrt(d.X*d.X+d.Y*d.Y+d.Z*d.Z); + if (dist>1E-3) { + tmp=1/dist; + d.X*=tmp; + d.Y*=tmp; + d.Z*=tmp; + } + att=1.0f/(l->attenuation[0]+dist*(l->attenuation[1]+ + dist*l->attenuation[2])); + } + dot=d.X*n.X+d.Y*n.Y+d.Z*n.Z; + if (twoside && dot < 0) dot = -dot; + if (dot>0) { + /* diffuse light */ + lR+=dot * l->diffuse.v[0] * m->diffuse.v[0]; + lG+=dot * l->diffuse.v[1] * m->diffuse.v[1]; + lB+=dot * l->diffuse.v[2] * m->diffuse.v[2]; + + /* spot light */ + if (l->spot_cutoff != 180) { + dot_spot=-(d.X*l->norm_spot_direction.v[0]+ + d.Y*l->norm_spot_direction.v[1]+ + d.Z*l->norm_spot_direction.v[2]); + if (twoside && dot_spot < 0) dot_spot = -dot_spot; + if (dot_spot < l->cos_spot_cutoff) { + /* no contribution */ + continue; + } else { + /* TODO: optimize */ + if (l->spot_exponent > 0) { + att=att*pow(dot_spot,l->spot_exponent); + } + } + } + + /* specular light */ + + if (c->local_light_model) { + V3 vcoord; + vcoord.X=v->ec.X; + vcoord.Y=v->ec.Y; + vcoord.Z=v->ec.Z; + gl_V3_Norm(&vcoord); + s.X=d.X-vcoord.X; + s.Y=d.Y-vcoord.X; + s.Z=d.Z-vcoord.X; + } else { + s.X=d.X; + s.Y=d.Y; + s.Z=d.Z+1.0; + } + dot_spec=n.X*s.X+n.Y*s.Y+n.Z*s.Z; + if (twoside && dot_spec < 0) dot_spec = -dot_spec; + if (dot_spec>0) { + GLSpecBuf *specbuf; + int idx; + tmp=sqrt(s.X*s.X+s.Y*s.Y+s.Z*s.Z); + if (tmp > 1E-3) { + dot_spec=dot_spec / tmp; + } + + /* TODO: optimize */ + /* testing specular buffer code */ + /* dot_spec= pow(dot_spec,m->shininess);*/ + specbuf = specbuf_get_buffer(c, m->shininess_i, m->shininess); + idx = (int)(dot_spec*SPECULAR_BUFFER_SIZE); + if (idx > SPECULAR_BUFFER_SIZE) idx = SPECULAR_BUFFER_SIZE; + dot_spec = specbuf->buf[idx]; + lR+=dot_spec * l->specular.v[0] * m->specular.v[0]; + lG+=dot_spec * l->specular.v[1] * m->specular.v[1]; + lB+=dot_spec * l->specular.v[2] * m->specular.v[2]; + } + } + + R+=att * lR; + G+=att * lG; + B+=att * lB; + } + + v->color.v[0]=clampf(R,0,1); + v->color.v[1]=clampf(G,0,1); + v->color.v[2]=clampf(B,0,1); + v->color.v[3]=A; +} + diff --git a/programs/develop/libraries/TinyGL/src/list.c b/programs/develop/libraries/TinyGL/src/list.c new file mode 100644 index 0000000000..1d16f9906e --- /dev/null +++ b/programs/develop/libraries/TinyGL/src/list.c @@ -0,0 +1,251 @@ +#include "zgl.h" + +static char *op_table_str[]= +{ +#define ADD_OP(a,b,c) "gl" #a " " #c, + +#include "opinfo.h" +}; + +static void (*op_table_func[])(GLContext *,GLParam *)= +{ +#define ADD_OP(a,b,c) glop ## a , + +#include "opinfo.h" +}; + +static int op_table_size[]= +{ +#define ADD_OP(a,b,c) b + 1 , + +#include "opinfo.h" +}; + + + +static GLList *find_list(GLContext *c,unsigned int list) +{ + return c->shared_state.lists[list]; +} + +static void delete_list(GLContext *c,int list) +{ + GLParamBuffer *pb,*pb1; + GLList *l; + + l=find_list(c,list); + assert(l != NULL); + + /* free param buffer */ + pb=l->first_op_buffer; + while (pb!=NULL) { + pb1=pb->next; + gl_free(pb); + pb=pb1; + } + + gl_free(l); + c->shared_state.lists[list]=NULL; +} + +static GLList *alloc_list(GLContext *c,int list) +{ + GLList *l; + GLParamBuffer *ob; + + l=gl_zalloc(sizeof(GLList)); + ob=gl_zalloc(sizeof(GLParamBuffer)); + + ob->next=NULL; + l->first_op_buffer=ob; + + ob->ops[0].op=OP_EndList; + + c->shared_state.lists[list]=l; + return l; +} + + +void gl_print_op(FILE *f,GLParam *p) +{ + int op; + char *s; + + op=p[0].op; + p++; + s=op_table_str[op]; + while (*s != 0) { + if (*s == '%') { + s++; + switch (*s++) { + case 'f': + fprintf(f,"%g",p[0].f); + break; + default: + fprintf(f,"%d",p[0].i); + break; + } + p++; + } else { + fputc(*s,f); + s++; + } + } + fprintf(f,"\n"); +} + + +void gl_compile_op(GLContext *c,GLParam *p) +{ + int op,op_size; + GLParamBuffer *ob,*ob1; + int index,i; + + op=p[0].op; + op_size=op_table_size[op]; + index=c->current_op_buffer_index; + ob=c->current_op_buffer; + + /* we should be able to add a NextBuffer opcode */ + if ((index + op_size) > (OP_BUFFER_MAX_SIZE-2)) { + + ob1=gl_zalloc(sizeof(GLParamBuffer)); + ob1->next=NULL; + + ob->next=ob1; + ob->ops[index].op=OP_NextBuffer; + ob->ops[index+1].p=(void *)ob1; + + c->current_op_buffer=ob1; + ob=ob1; + index=0; + } + + for(i=0;iops[index]=p[i]; + index++; + } + c->current_op_buffer_index=index; +} + +void gl_add_op(GLParam *p) +{ + GLContext *c=gl_get_context(); + int op; + + op=p[0].op; + if (c->exec_flag) { + op_table_func[op](c,p); + } + if (c->compile_flag) { + gl_compile_op(c,p); + } + if (c->print_flag) { + gl_print_op(stderr,p); + } +} + +/* this opcode is never called directly */ +void glopEndList(GLContext *c,GLParam *p) +{ + assert(0); +} + +/* this opcode is never called directly */ +void glopNextBuffer(GLContext *c,GLParam *p) +{ + assert(0); +} + + +void glopCallList(GLContext *c,GLParam *p) +{ + GLList *l; + int list,op; + + list=p[1].ui; + l=find_list(c,list); + if (l == NULL) gl_fatal_error("list %d not defined",list); + p=l->first_op_buffer->ops; + + while (1) { + op=p[0].op; + if (op == OP_EndList) break; + if (op == OP_NextBuffer) { + p=(GLParam *)p[1].p; + } else { + op_table_func[op](c,p); + p+=op_table_size[op]; + } + } +} + + + +void glNewList(unsigned int list,int mode) +{ + GLList *l; + GLContext *c=gl_get_context(); + + assert(mode == GL_COMPILE || mode == GL_COMPILE_AND_EXECUTE); + assert(c->compile_flag == 0); + + l=find_list(c,list); + if (l!=NULL) delete_list(c,list); + l=alloc_list(c,list); + + c->current_op_buffer=l->first_op_buffer; + c->current_op_buffer_index=0; + + c->compile_flag=1; + c->exec_flag=(mode == GL_COMPILE_AND_EXECUTE); +} + +void glEndList(void) +{ + GLContext *c=gl_get_context(); + GLParam p[1]; + + assert(c->compile_flag == 1); + + /* end of list */ + p[0].op=OP_EndList; + gl_compile_op(c,p); + + c->compile_flag=0; + c->exec_flag=1; +} + +int glIsList(unsigned int list) +{ + GLContext *c=gl_get_context(); + GLList *l; + l=find_list(c,list); + return (l != NULL); +} + +unsigned int glGenLists(int range) +{ + GLContext *c=gl_get_context(); + int count,i,list; + GLList **lists; + + lists=c->shared_state.lists; + count=0; + for(i=0;imatrix_model_projection_updated=(c->matrix_mode<=1); +} + + +void glopMatrixMode(GLContext *c,GLParam *p) +{ + int mode=p[1].i; + switch(mode) { + case GL_MODELVIEW: + c->matrix_mode=0; + break; + case GL_PROJECTION: + c->matrix_mode=1; + break; + case GL_TEXTURE: + c->matrix_mode=2; + break; + default: + assert(0); + } +} + +void glopLoadMatrix(GLContext *c,GLParam *p) +{ + M4 *m; + int i; + + GLParam *q; + + m=c->matrix_stack_ptr[c->matrix_mode]; + q=p+1; + + for(i=0;i<4;i++) { + m->m[0][i]=q[0].f; + m->m[1][i]=q[1].f; + m->m[2][i]=q[2].f; + m->m[3][i]=q[3].f; + q+=4; + } + + gl_matrix_update(c); +} + +void glopLoadIdentity(GLContext *c,GLParam *p) +{ + + gl_M4_Id(c->matrix_stack_ptr[c->matrix_mode]); + + gl_matrix_update(c); +} + +void glopMultMatrix(GLContext *c,GLParam *p) +{ + M4 m; + int i; + + GLParam *q; + q=p+1; + + for(i=0;i<4;i++) { + m.m[0][i]=q[0].f; + m.m[1][i]=q[1].f; + m.m[2][i]=q[2].f; + m.m[3][i]=q[3].f; + q+=4; + } + + gl_M4_MulLeft(c->matrix_stack_ptr[c->matrix_mode],&m); + + gl_matrix_update(c); +} + + +void glopPushMatrix(GLContext *c,GLParam *p) +{ + int n=c->matrix_mode; + M4 *m; + + assert( (c->matrix_stack_ptr[n] - c->matrix_stack[n] + 1 ) + < c->matrix_stack_depth_max[n] ); + + m=++c->matrix_stack_ptr[n]; + + gl_M4_Move(&m[0],&m[-1]); + + gl_matrix_update(c); +} + +void glopPopMatrix(GLContext *c,GLParam *p) +{ + int n=c->matrix_mode; + + assert( c->matrix_stack_ptr[n] > c->matrix_stack[n] ); + c->matrix_stack_ptr[n]--; + gl_matrix_update(c); +} + + +void glopRotate(GLContext *c,GLParam *p) +{ + M4 m; + float u[3]; + float angle; + int dir_code; + + angle = p[1].f * M_PI / 180.0; + u[0]=p[2].f; + u[1]=p[3].f; + u[2]=p[4].f; + + /* simple case detection */ + dir_code = ((u[0] != 0)<<2) | ((u[1] != 0)<<1) | (u[2] != 0); + + switch(dir_code) { + case 0: + gl_M4_Id(&m); + break; + case 4: + if (u[0] < 0) angle=-angle; + gl_M4_Rotate(&m,angle,0); + break; + case 2: + if (u[1] < 0) angle=-angle; + gl_M4_Rotate(&m,angle,1); + break; + case 1: + if (u[2] < 0) angle=-angle; + gl_M4_Rotate(&m,angle,2); + break; + default: + { + float cost, sint; + + /* normalize vector */ + float len = u[0]*u[0]+u[1]*u[1]+u[2]*u[2]; + if (len == 0.0f) return; + len = 1.0f / sqrt(len); + u[0] *= len; + u[1] *= len; + u[2] *= len; + + /* store cos and sin values */ + cost=cos(angle); + sint=sin(angle); + + /* fill in the values */ + m.m[3][0]=m.m[3][1]=m.m[3][2]= + m.m[0][3]=m.m[1][3]=m.m[2][3]=0.0f; + m.m[3][3]=1.0f; + + /* do the math */ + m.m[0][0]=u[0]*u[0]+cost*(1-u[0]*u[0]); + m.m[1][0]=u[0]*u[1]*(1-cost)-u[2]*sint; + m.m[2][0]=u[2]*u[0]*(1-cost)+u[1]*sint; + m.m[0][1]=u[0]*u[1]*(1-cost)+u[2]*sint; + m.m[1][1]=u[1]*u[1]+cost*(1-u[1]*u[1]); + m.m[2][1]=u[1]*u[2]*(1-cost)-u[0]*sint; + m.m[0][2]=u[2]*u[0]*(1-cost)-u[1]*sint; + m.m[1][2]=u[1]*u[2]*(1-cost)+u[0]*sint; + m.m[2][2]=u[2]*u[2]+cost*(1-u[2]*u[2]); + } + } + + gl_M4_MulLeft(c->matrix_stack_ptr[c->matrix_mode],&m); + + gl_matrix_update(c); +} + +void glopScale(GLContext *c,GLParam *p) +{ + float *m; + float x=p[1].f,y=p[2].f,z=p[3].f; + + m=&c->matrix_stack_ptr[c->matrix_mode]->m[0][0]; + + m[0] *= x; m[1] *= y; m[2] *= z; + m[4] *= x; m[5] *= y; m[6] *= z; + m[8] *= x; m[9] *= y; m[10] *= z; + m[12] *= x; m[13] *= y; m[14] *= z; + gl_matrix_update(c); +} + +void glopTranslate(GLContext *c,GLParam *p) +{ + float *m; + float x=p[1].f,y=p[2].f,z=p[3].f; + + m=&c->matrix_stack_ptr[c->matrix_mode]->m[0][0]; + + m[3] = m[0] * x + m[1] * y + m[2] * z + m[3]; + m[7] = m[4] * x + m[5] * y + m[6] * z + m[7]; + m[11] = m[8] * x + m[9] * y + m[10] * z + m[11]; + m[15] = m[12] * x + m[13] * y + m[14] * z + m[15]; + + gl_matrix_update(c); +} + + +void glopFrustum(GLContext *c,GLParam *p) +{ + float *r; + M4 m; + float left=p[1].f; + float right=p[2].f; + float bottom=p[3].f; + float top=p[4].f; + float near=p[5].f; + float farp=p[6].f; + float x,y,A,B,C,D; + + x = (2.0*near) / (right-left); + y = (2.0*near) / (top-bottom); + A = (right+left) / (right-left); + B = (top+bottom) / (top-bottom); + C = -(farp+near) / ( farp-near); + D = -(2.0*farp*near) / (farp-near); + + r=&m.m[0][0]; + r[0]= x; r[1]=0; r[2]=A; r[3]=0; + r[4]= 0; r[5]=y; r[6]=B; r[7]=0; + r[8]= 0; r[9]=0; r[10]=C; r[11]=D; + r[12]= 0; r[13]=0; r[14]=-1; r[15]=0; + + gl_M4_MulLeft(c->matrix_stack_ptr[c->matrix_mode],&m); + + gl_matrix_update(c); +} + diff --git a/programs/develop/libraries/TinyGL/src/misc.c b/programs/develop/libraries/TinyGL/src/misc.c new file mode 100644 index 0000000000..6b827712af --- /dev/null +++ b/programs/develop/libraries/TinyGL/src/misc.c @@ -0,0 +1,147 @@ +#include "zgl.h" +#include "msghandling.h" + +void glopViewport(GLContext *c,GLParam *p) +{ + int xsize,ysize,xmin,ymin,xsize_req,ysize_req; + + xmin=p[1].i; + ymin=p[2].i; + xsize=p[3].i; + ysize=p[4].i; + + /* we may need to resize the zbuffer */ + + if (c->viewport.xmin != xmin || + c->viewport.ymin != ymin || + c->viewport.xsize != xsize || + c->viewport.ysize != ysize) { + + xsize_req=xmin+xsize; + ysize_req=ymin+ysize; + + if (c->gl_resize_viewport && + c->gl_resize_viewport(c,&xsize_req,&ysize_req) != 0) { + gl_fatal_error("glViewport: error while resizing display"); + } + + xsize=xsize_req-xmin; + ysize=ysize_req-ymin; + if (xsize <= 0 || ysize <= 0) { + gl_fatal_error("glViewport: size too small"); + } + + tgl_trace("glViewport: %d %d %d %d\n", + xmin, ymin, xsize, ysize); + c->viewport.xmin=xmin; + c->viewport.ymin=ymin; + c->viewport.xsize=xsize; + c->viewport.ysize=ysize; + + c->viewport.updated=1; + } +} + +void glopEnableDisable(GLContext *c,GLParam *p) +{ + int code=p[1].i; + int v=p[2].i; + + switch(code) { + case GL_CULL_FACE: + c->cull_face_enabled=v; + break; + case GL_LIGHTING: + c->lighting_enabled=v; + break; + case GL_COLOR_MATERIAL: + c->color_material_enabled=v; + break; + case GL_TEXTURE_2D: + c->texture_2d_enabled=v; + break; + case GL_NORMALIZE: + c->normalize_enabled=v; + break; + case GL_DEPTH_TEST: + c->depth_test = v; + break; + case GL_POLYGON_OFFSET_FILL: + if (v) c->offset_states |= TGL_OFFSET_FILL; + else c->offset_states &= ~TGL_OFFSET_FILL; + break; + case GL_POLYGON_OFFSET_POINT: + if (v) c->offset_states |= TGL_OFFSET_POINT; + else c->offset_states &= ~TGL_OFFSET_POINT; + break; + case GL_POLYGON_OFFSET_LINE: + if (v) c->offset_states |= TGL_OFFSET_LINE; + else c->offset_states &= ~TGL_OFFSET_LINE; + break; + default: + if (code>=GL_LIGHT0 && codecurrent_shade_model=code; +} + +void glopCullFace(GLContext *c,GLParam *p) +{ + int code=p[1].i; + c->current_cull_face=code; +} + +void glopFrontFace(GLContext *c,GLParam *p) +{ + int code=p[1].i; + c->current_front_face=code; +} + +void glopPolygonMode(GLContext *c,GLParam *p) +{ + int face=p[1].i; + int mode=p[2].i; + + switch(face) { + case GL_BACK: + c->polygon_mode_back=mode; + break; + case GL_FRONT: + c->polygon_mode_front=mode; + break; + case GL_FRONT_AND_BACK: + c->polygon_mode_front=mode; + c->polygon_mode_back=mode; + break; + default: + assert(0); + } +} + +void glopHint(GLContext *c,GLParam *p) +{ +#if 0 + int target=p[1].i; + int mode=p[2].i; + + /* do nothing */ +#endif +} + +void +glopPolygonOffset(GLContext *c, GLParam *p) +{ + c->offset_factor = p[1].f; + c->offset_units = p[2].f; +} diff --git a/programs/develop/libraries/TinyGL/src/msghandling.c b/programs/develop/libraries/TinyGL/src/msghandling.c new file mode 100644 index 0000000000..c5b10614d8 --- /dev/null +++ b/programs/develop/libraries/TinyGL/src/msghandling.c @@ -0,0 +1,52 @@ +#include +#include + +#define NDEBUG + +#ifdef NDEBUG +#define NO_DEBUG_OUTPUT +#endif + +/* Use this function to output messages when something unexpected + happens (which might be an indication of an error). *Don't* use it + when there's internal errors in the code - these should be handled + by asserts. */ +void +tgl_warning(const char *format, ...) +{ +#ifndef NO_DEBUG_OUTPUT + va_list args; + va_start(args, format); + fprintf(stderr, "*WARNING* "); + vfprintf(stderr, format, args); + va_end(args); +#endif /* !NO_DEBUG_OUTPUT */ +} + +/* This function should be used for debug output only. */ +void +tgl_trace(const char *format, ...) +{ +#ifndef NO_DEBUG_OUTPUT + va_list args; + va_start(args, format); + fprintf(stderr, "*DEBUG* "); + vfprintf(stderr, format, args); + va_end(args); +#endif /* !NO_DEBUG_OUTPUT */ +} + +/* Use this function to output info about things in the code which + should be fixed (missing handling of special cases, important + features not implemented, known bugs/buglets, ...). */ +void +tgl_fixme(const char *format, ...) +{ +#ifndef NO_DEBUG_OUTPUT + va_list args; + va_start(args, format); + fprintf(stderr, "*FIXME* "); + vfprintf(stderr, format, args); + va_end(args); +#endif /* !NO_DEBUG_OUTPUT */ +} diff --git a/programs/develop/libraries/TinyGL/src/msghandling.h b/programs/develop/libraries/TinyGL/src/msghandling.h new file mode 100644 index 0000000000..ebe4548c0e --- /dev/null +++ b/programs/develop/libraries/TinyGL/src/msghandling.h @@ -0,0 +1,8 @@ +#ifndef _msghandling_h_ +#define _msghandling_h_ + +extern void tgl_warning(const char *text, ...); +extern void tgl_trace(const char *text, ...); +extern void tgl_fixme(const char *text, ...); + +#endif /* _msghandling_h_ */ diff --git a/programs/develop/libraries/TinyGL/src/opinfo.h b/programs/develop/libraries/TinyGL/src/opinfo.h new file mode 100644 index 0000000000..e57344e831 --- /dev/null +++ b/programs/develop/libraries/TinyGL/src/opinfo.h @@ -0,0 +1,71 @@ + + +ADD_OP(Color,7,"%f %f %f %f %d %d %d") +ADD_OP(TexCoord,4,"%f %f %f %f") +ADD_OP(EdgeFlag,1,"%d") +ADD_OP(Normal,3,"%f %f %f") + +ADD_OP(Begin,1,"%C") +ADD_OP(Vertex,4,"%f %f %f %f") +ADD_OP(End,0,"") + +ADD_OP(EnableDisable,2,"%C %d") + +ADD_OP(MatrixMode,1,"%C") +ADD_OP(LoadMatrix,16,"") +ADD_OP(LoadIdentity,0,"") +ADD_OP(MultMatrix,16,"") +ADD_OP(PushMatrix,0,"") +ADD_OP(PopMatrix,0,"") +ADD_OP(Rotate,4,"%f %f %f %f") +ADD_OP(Translate,3,"%f %f %f") +ADD_OP(Scale,3,"%f %f %f") + +ADD_OP(Viewport,4,"%d %d %d %d") +ADD_OP(Frustum,6,"%f %f %f %f %f %f") + +ADD_OP(Material,6,"%C %C %f %f %f %f") +ADD_OP(ColorMaterial,2,"%C %C") +ADD_OP(Light,6,"%C %C %f %f %f %f") +ADD_OP(LightModel,5,"%C %f %f %f %f") + +ADD_OP(Clear,1,"%d") +ADD_OP(ClearColor,4,"%f %f %f %f") +ADD_OP(ClearDepth,1,"%f") + +ADD_OP(InitNames,0,"") +ADD_OP(PushName,1,"%d") +ADD_OP(PopName,0,"") +ADD_OP(LoadName,1,"%d") + +ADD_OP(TexImage2D,9,"%d %d %d %d %d %d %d %d %d") +ADD_OP(BindTexture,2,"%C %d") +ADD_OP(TexEnv,7,"%C %C %C %f %f %f %f") +ADD_OP(TexParameter,7,"%C %C %C %f %f %f %f") +ADD_OP(PixelStore,2,"%C %C") + +ADD_OP(ShadeModel,1,"%C") +ADD_OP(CullFace,1,"%C") +ADD_OP(FrontFace,1,"%C") +ADD_OP(PolygonMode,2,"%C %C") + +ADD_OP(CallList,1,"%d") +ADD_OP(Hint,2,"%C %C") + +/* special opcodes */ +ADD_OP(EndList,0,"") +ADD_OP(NextBuffer,1,"%p") + +/* opengl 1.1 arrays */ +ADD_OP(ArrayElement, 1, "%d") +ADD_OP(EnableClientState, 1, "%C") +ADD_OP(DisableClientState, 1, "%C") +ADD_OP(VertexPointer, 4, "%d %C %d %p") +ADD_OP(ColorPointer, 4, "%d %C %d %p") +ADD_OP(NormalPointer, 3, "%C %d %p") +ADD_OP(TexCoordPointer, 4, "%d %C %d %p") + +/* opengl 1.1 polygon offset */ +ADD_OP(PolygonOffset, 2, "%f %f") + +#undef ADD_OP diff --git a/programs/develop/libraries/TinyGL/src/select.c b/programs/develop/libraries/TinyGL/src/select.c new file mode 100644 index 0000000000..bf416eec16 --- /dev/null +++ b/programs/develop/libraries/TinyGL/src/select.c @@ -0,0 +1,114 @@ +#include "zgl.h" + +int glRenderMode(int mode) +{ + GLContext *c=gl_get_context(); + int result=0; + + switch(c->render_mode) { + case GL_RENDER: + break; + case GL_SELECT: + if (c->select_overflow) { + result=-c->select_hits; + } else { + result=c->select_hits; + } + c->select_overflow=0; + c->select_ptr=c->select_buffer; + c->name_stack_size=0; + break; + default: + assert(0); + } + switch(mode) { + case GL_RENDER: + c->render_mode=GL_RENDER; + break; + case GL_SELECT: + c->render_mode=GL_SELECT; + assert( c->select_buffer != NULL); + c->select_ptr=c->select_buffer; + c->select_hits=0; + c->select_overflow=0; + c->select_hit=NULL; + break; + default: + assert(0); + } + return result; +} + +void glSelectBuffer(int size,unsigned int *buf) +{ + GLContext *c=gl_get_context(); + + assert(c->render_mode != GL_SELECT); + + c->select_buffer=buf; + c->select_size=size; +} + + +void glopInitNames(GLContext *c,GLParam *p) +{ + if (c->render_mode == GL_SELECT) { + c->name_stack_size=0; + c->select_hit=NULL; + } +} + +void glopPushName(GLContext *c,GLParam *p) +{ + if (c->render_mode == GL_SELECT) { + assert(c->name_stack_sizename_stack[c->name_stack_size++]=p[1].i; + c->select_hit=NULL; + } +} + +void glopPopName(GLContext *c,GLParam *p) +{ + if (c->render_mode == GL_SELECT) { + assert(c->name_stack_size>0); + c->name_stack_size--; + c->select_hit=NULL; + } +} + +void glopLoadName(GLContext *c,GLParam *p) +{ + if (c->render_mode == GL_SELECT) { + assert(c->name_stack_size>0); + c->name_stack[c->name_stack_size-1]=p[1].i; + c->select_hit=NULL; + } +} + +void gl_add_select(GLContext *c,unsigned int zmin,unsigned int zmax) +{ + unsigned int *ptr; + int n,i; + + if (!c->select_overflow) { + if (c->select_hit==NULL) { + n=c->name_stack_size; + if ((c->select_ptr-c->select_buffer+3+n) > + c->select_size) { + c->select_overflow=1; + } else { + ptr=c->select_ptr; + c->select_hit=ptr; + *ptr++=c->name_stack_size; + *ptr++=zmin; + *ptr++=zmax; + for(i=0;iname_stack[i]; + c->select_ptr=ptr; + c->select_hits++; + } + } else { + if (zminselect_hit[1]) c->select_hit[1]=zmin; + if (zmax>c->select_hit[2]) c->select_hit[2]=zmax; + } + } +} diff --git a/programs/develop/libraries/TinyGL/src/specbuf.c b/programs/develop/libraries/TinyGL/src/specbuf.c new file mode 100644 index 0000000000..7cbfb05717 --- /dev/null +++ b/programs/develop/libraries/TinyGL/src/specbuf.c @@ -0,0 +1,52 @@ +#include "zgl.h" +#include "msghandling.h" +#include +#include + +static void calc_buf(GLSpecBuf *buf, const float shininess) +{ + int i; + float val, inc; + val = 0.0f; + inc = 1.0f/SPECULAR_BUFFER_SIZE; + for (i = 0; i <= SPECULAR_BUFFER_SIZE; i++) { + buf->buf[i] = pow(val, shininess); + val += inc; + } +} + +GLSpecBuf * +specbuf_get_buffer(GLContext *c, const int shininess_i, + const float shininess) +{ + GLSpecBuf *found, *oldest; + found = oldest = c->specbuf_first; + while (found && found->shininess_i != shininess_i) { + if (found->last_used < oldest->last_used) { + oldest = found; + } + found = found->next; + } + if (found) { /* hey, found one! */ + found->last_used = c->specbuf_used_counter++; + return found; + } + if (oldest == NULL || c->specbuf_num_buffers < MAX_SPECULAR_BUFFERS) { + /* create new buffer */ + GLSpecBuf *buf = gl_malloc(sizeof(GLSpecBuf)); + if (!buf) gl_fatal_error("could not allocate specular buffer"); + c->specbuf_num_buffers++; + buf->next = c->specbuf_first; + c->specbuf_first = buf; + buf->last_used = c->specbuf_used_counter++; + buf->shininess_i = shininess_i; + calc_buf(buf, shininess); + return buf; + } + /* overwrite the lru buffer */ + /*tgl_trace("overwriting spec buffer :(\n");*/ + oldest->shininess_i = shininess_i; + oldest->last_used = c->specbuf_used_counter++; + calc_buf(oldest, shininess); + return oldest; +} diff --git a/programs/develop/libraries/TinyGL/src/specbuf.h b/programs/develop/libraries/TinyGL/src/specbuf.h new file mode 100644 index 0000000000..ae5da3f877 --- /dev/null +++ b/programs/develop/libraries/TinyGL/src/specbuf.h @@ -0,0 +1,22 @@ +#ifndef _tgl_specbuf_h_ +#define _tgl_specbuf_h_ + +/* Max # of specular light pow buffers */ +#define MAX_SPECULAR_BUFFERS 8 +/* # of entries in specular buffer */ +#define SPECULAR_BUFFER_SIZE 1024 +/* specular buffer granularity */ +#define SPECULAR_BUFFER_RESOLUTION 1024 + +typedef struct GLSpecBuf { + int shininess_i; + int last_used; + float buf[SPECULAR_BUFFER_SIZE+1]; + struct GLSpecBuf *next; +} GLSpecBuf; + +GLSpecBuf *specbuf_get_buffer(GLContext *c, const int shininess_i, + const float shininess); +void specbuf_cleanup(GLContext *c); /* free all memory used */ + +#endif /* _tgl_specbuf_h_ */ \ No newline at end of file diff --git a/programs/develop/libraries/TinyGL/src/texture.c b/programs/develop/libraries/TinyGL/src/texture.c new file mode 100644 index 0000000000..bec9ac5f1a --- /dev/null +++ b/programs/develop/libraries/TinyGL/src/texture.c @@ -0,0 +1,229 @@ +/* + * Texture Manager + */ + +#include "zgl.h" + +static GLTexture *find_texture(GLContext *c,int h) +{ + GLTexture *t; + + t=c->shared_state.texture_hash_table[h % TEXTURE_HASH_TABLE_SIZE]; + while (t!=NULL) { + if (t->handle == h) return t; + t=t->next; + } + return NULL; +} + +static void free_texture(GLContext *c,int h) +{ + GLTexture *t,**ht; + GLImage *im; + int i; + + t=find_texture(c,h); + if (t->prev==NULL) { + ht=&c->shared_state.texture_hash_table + [t->handle % TEXTURE_HASH_TABLE_SIZE]; + *ht=t->next; + } else { + t->prev->next=t->next; + } + if (t->next!=NULL) t->next->prev=t->prev; + + for(i=0;iimages[i]; + if (im->pixmap != NULL) gl_free(im->pixmap); + } + + gl_free(t); +} + +GLTexture *alloc_texture(GLContext *c,int h) +{ + GLTexture *t,**ht; + + t=gl_zalloc(sizeof(GLTexture)); + + ht=&c->shared_state.texture_hash_table[h % TEXTURE_HASH_TABLE_SIZE]; + + t->next=*ht; + t->prev=NULL; + if (t->next != NULL) t->next->prev=t; + *ht=t; + + t->handle=h; + + return t; +} + + +void glInitTextures(GLContext *c) +{ + /* textures */ + + c->texture_2d_enabled=0; + c->current_texture=find_texture(c,0); +} + +void glGenTextures(int n, unsigned int *textures) +{ + GLContext *c=gl_get_context(); + int max,i; + GLTexture *t; + + max=0; + for(i=0;ishared_state.texture_hash_table[i]; + while (t!=NULL) { + if (t->handle>max) max=t->handle; + t=t->next; + } + + } + for(i=0;icurrent_texture) { + glBindTexture(GL_TEXTURE_2D,0); + } + free_texture(c,textures[i]); + } + } +} + + +void glopBindTexture(GLContext *c,GLParam *p) +{ + int target=p[1].i; + int texture=p[2].i; + GLTexture *t; + + assert(target == GL_TEXTURE_2D && texture >= 0); + + t=find_texture(c,texture); + if (t==NULL) { + t=alloc_texture(c,texture); + } + c->current_texture=t; +} + +void glopTexImage2D(GLContext *c,GLParam *p) +{ + int target=p[1].i; + int level=p[2].i; + int components=p[3].i; + int width=p[4].i; + int height=p[5].i; + int border=p[6].i; + int format=p[7].i; + int type=p[8].i; + void *pixels=p[9].p; + GLImage *im; + unsigned char *pixels1; + int do_free; + + if (!(target == GL_TEXTURE_2D && level == 0 && components == 3 && + border == 0 && format == GL_RGB && + type == GL_UNSIGNED_BYTE)) { + gl_fatal_error("glTexImage2D: combinaison of parameters not handled"); + } + + do_free=0; + if (width != 256 || height != 256) { + pixels1 = gl_malloc(256 * 256 * 3); + /* no interpolation is done here to respect the original image aliasing ! */ + gl_resizeImageNoInterpolate(pixels1,256,256,pixels,width,height); + do_free=1; + width=256; + height=256; + } else { + pixels1=pixels; + } + + im=&c->current_texture->images[level]; + im->xsize=width; + im->ysize=height; + if (im->pixmap!=NULL) gl_free(im->pixmap); +#if TGL_FEATURE_RENDER_BITS == 24 + im->pixmap=gl_malloc(width*height*3); + if(im->pixmap) { + memcpy(im->pixmap,pixels1,width*height*3); + } +#elif TGL_FEATURE_RENDER_BITS == 32 + im->pixmap=gl_malloc(width*height*4); + if(im->pixmap) { + gl_convertRGB_to_8A8R8G8B(im->pixmap,pixels1,width,height); + } +#elif TGL_FEATURE_RENDER_BITS == 16 + im->pixmap=gl_malloc(width*height*2); + if(im->pixmap) { + gl_convertRGB_to_5R6G5B(im->pixmap,pixels1,width,height); + } +#else +#error TODO +#endif + if (do_free) gl_free(pixels1); +} + + +/* TODO: not all tests are done */ +void glopTexEnv(GLContext *c,GLParam *p) +{ + int target=p[1].i; + int pname=p[2].i; + int param=p[3].i; + + if (target != GL_TEXTURE_ENV) { + error: + gl_fatal_error("glTexParameter: unsupported option"); + } + + if (pname != GL_TEXTURE_ENV_MODE) goto error; + + if (param != GL_DECAL) goto error; +} + +/* TODO: not all tests are done */ +void glopTexParameter(GLContext *c,GLParam *p) +{ + int target=p[1].i; + int pname=p[2].i; + int param=p[3].i; + + if (target != GL_TEXTURE_2D) { + error: + gl_fatal_error("glTexParameter: unsupported option"); + } + + switch(pname) { + case GL_TEXTURE_WRAP_S: + case GL_TEXTURE_WRAP_T: + if (param != GL_REPEAT) goto error; + break; + } +} + +void glopPixelStore(GLContext *c,GLParam *p) +{ + int pname=p[1].i; + int param=p[2].i; + + if (pname != GL_UNPACK_ALIGNMENT || + param != 1) { + gl_fatal_error("glPixelStore: unsupported option"); + } +} diff --git a/programs/develop/libraries/TinyGL/src/vertex.c b/programs/develop/libraries/TinyGL/src/vertex.c new file mode 100644 index 0000000000..6eb159c2fc --- /dev/null +++ b/programs/develop/libraries/TinyGL/src/vertex.c @@ -0,0 +1,364 @@ +#include "zgl.h" + +void glopNormal(GLContext * c, GLParam * p) +{ + V3 v; + + v.X = p[1].f; + v.Y = p[2].f; + v.Z = p[3].f; + + c->current_normal.X = v.X; + c->current_normal.Y = v.Y; + c->current_normal.Z = v.Z; + c->current_normal.W = 0; +} + +void glopTexCoord(GLContext * c, GLParam * p) +{ + c->current_tex_coord.X = p[1].f; + c->current_tex_coord.Y = p[2].f; + c->current_tex_coord.Z = p[3].f; + c->current_tex_coord.W = p[4].f; +} + +void glopEdgeFlag(GLContext * c, GLParam * p) +{ + c->current_edge_flag = p[1].i; +} + +void glopColor(GLContext * c, GLParam * p) +{ + + c->current_color.X = p[1].f; + c->current_color.Y = p[2].f; + c->current_color.Z = p[3].f; + c->current_color.W = p[4].f; + c->longcurrent_color[0] = p[5].ui; + c->longcurrent_color[1] = p[6].ui; + c->longcurrent_color[2] = p[7].ui; + + if (c->color_material_enabled) { + GLParam q[7]; + q[0].op = OP_Material; + q[1].i = c->current_color_material_mode; + q[2].i = c->current_color_material_type; + q[3].f = p[1].f; + q[4].f = p[2].f; + q[5].f = p[3].f; + q[6].f = p[4].f; + glopMaterial(c, q); + } +} + + +void gl_eval_viewport(GLContext * c) +{ + GLViewport *v; + float zsize = (1 << (ZB_Z_BITS + ZB_POINT_Z_FRAC_BITS)); + + v = &c->viewport; + + v->trans.X = ((v->xsize - 0.5) / 2.0) + v->xmin; + v->trans.Y = ((v->ysize - 0.5) / 2.0) + v->ymin; + v->trans.Z = ((zsize - 0.5) / 2.0) + ((1 << ZB_POINT_Z_FRAC_BITS)) / 2; + + v->scale.X = (v->xsize - 0.5) / 2.0; + v->scale.Y = -(v->ysize - 0.5) / 2.0; + v->scale.Z = -((zsize - 0.5) / 2.0); +} + +void glopBegin(GLContext * c, GLParam * p) +{ + int type; + M4 tmp; + + assert(c->in_begin == 0); + + type = p[1].i; + c->begin_type = type; + c->in_begin = 1; + c->vertex_n = 0; + c->vertex_cnt = 0; + + if (c->matrix_model_projection_updated) { + + if (c->lighting_enabled) { + /* precompute inverse modelview */ + gl_M4_Inv(&tmp, c->matrix_stack_ptr[0]); + gl_M4_Transpose(&c->matrix_model_view_inv, &tmp); + } else { + float *m = &c->matrix_model_projection.m[0][0]; + /* precompute projection matrix */ + gl_M4_Mul(&c->matrix_model_projection, + c->matrix_stack_ptr[1], + c->matrix_stack_ptr[0]); + /* test to accelerate computation */ + c->matrix_model_projection_no_w_transform = 0; + if (m[12] == 0.0 && m[13] == 0.0 && m[14] == 0.0) + c->matrix_model_projection_no_w_transform = 1; + } + + /* test if the texture matrix is not Identity */ + c->apply_texture_matrix = !gl_M4_IsId(c->matrix_stack_ptr[2]); + + c->matrix_model_projection_updated = 0; + } + /* viewport */ + if (c->viewport.updated) { + gl_eval_viewport(c); + c->viewport.updated = 0; + } + /* triangle drawing functions */ + if (c->render_mode == GL_SELECT) { + c->draw_triangle_front = gl_draw_triangle_select; + c->draw_triangle_back = gl_draw_triangle_select; + } else { + switch (c->polygon_mode_front) { + case GL_POINT: + c->draw_triangle_front = gl_draw_triangle_point; + break; + case GL_LINE: + c->draw_triangle_front = gl_draw_triangle_line; + break; + default: + c->draw_triangle_front = gl_draw_triangle_fill; + break; + } + + switch (c->polygon_mode_back) { + case GL_POINT: + c->draw_triangle_back = gl_draw_triangle_point; + break; + case GL_LINE: + c->draw_triangle_back = gl_draw_triangle_line; + break; + default: + c->draw_triangle_back = gl_draw_triangle_fill; + break; + } + } +} + +/* coords, tranformation , clip code and projection */ +/* TODO : handle all cases */ +static inline void gl_vertex_transform(GLContext * c, GLVertex * v) +{ + float *m; + V4 *n; + + if (c->lighting_enabled) { + /* eye coordinates needed for lighting */ + + m = &c->matrix_stack_ptr[0]->m[0][0]; + v->ec.X = (v->coord.X * m[0] + v->coord.Y * m[1] + + v->coord.Z * m[2] + m[3]); + v->ec.Y = (v->coord.X * m[4] + v->coord.Y * m[5] + + v->coord.Z * m[6] + m[7]); + v->ec.Z = (v->coord.X * m[8] + v->coord.Y * m[9] + + v->coord.Z * m[10] + m[11]); + v->ec.W = (v->coord.X * m[12] + v->coord.Y * m[13] + + v->coord.Z * m[14] + m[15]); + + /* projection coordinates */ + m = &c->matrix_stack_ptr[1]->m[0][0]; + v->pc.X = (v->ec.X * m[0] + v->ec.Y * m[1] + + v->ec.Z * m[2] + v->ec.W * m[3]); + v->pc.Y = (v->ec.X * m[4] + v->ec.Y * m[5] + + v->ec.Z * m[6] + v->ec.W * m[7]); + v->pc.Z = (v->ec.X * m[8] + v->ec.Y * m[9] + + v->ec.Z * m[10] + v->ec.W * m[11]); + v->pc.W = (v->ec.X * m[12] + v->ec.Y * m[13] + + v->ec.Z * m[14] + v->ec.W * m[15]); + + m = &c->matrix_model_view_inv.m[0][0]; + n = &c->current_normal; + + v->normal.X = (n->X * m[0] + n->Y * m[1] + n->Z * m[2]); + v->normal.Y = (n->X * m[4] + n->Y * m[5] + n->Z * m[6]); + v->normal.Z = (n->X * m[8] + n->Y * m[9] + n->Z * m[10]); + + if (c->normalize_enabled) { + gl_V3_Norm(&v->normal); + } + } else { + /* no eye coordinates needed, no normal */ + /* NOTE: W = 1 is assumed */ + m = &c->matrix_model_projection.m[0][0]; + + v->pc.X = (v->coord.X * m[0] + v->coord.Y * m[1] + + v->coord.Z * m[2] + m[3]); + v->pc.Y = (v->coord.X * m[4] + v->coord.Y * m[5] + + v->coord.Z * m[6] + m[7]); + v->pc.Z = (v->coord.X * m[8] + v->coord.Y * m[9] + + v->coord.Z * m[10] + m[11]); + if (c->matrix_model_projection_no_w_transform) { + v->pc.W = m[15]; + } else { + v->pc.W = (v->coord.X * m[12] + v->coord.Y * m[13] + + v->coord.Z * m[14] + m[15]); + } + } + + v->clip_code = gl_clipcode(v->pc.X, v->pc.Y, v->pc.Z, v->pc.W); +} + +void glopVertex(GLContext * c, GLParam * p) +{ + GLVertex *v; + int n, i, cnt; + + assert(c->in_begin != 0); + + n = c->vertex_n; + cnt = c->vertex_cnt; + cnt++; + c->vertex_cnt = cnt; + + /* quick fix to avoid crashes on large polygons */ + if (n >= c->vertex_max) { + GLVertex *newarray; + c->vertex_max <<= 1; /* just double size */ + newarray = gl_malloc(sizeof(GLVertex) * c->vertex_max); + if (!newarray) { + gl_fatal_error("unable to allocate GLVertex array.\n"); + } + memcpy(newarray, c->vertex, n * sizeof(GLVertex)); + gl_free(c->vertex); + c->vertex = newarray; + } + /* new vertex entry */ + v = &c->vertex[n]; + n++; + + v->coord.X = p[1].f; + v->coord.Y = p[2].f; + v->coord.Z = p[3].f; + v->coord.W = p[4].f; + + gl_vertex_transform(c, v); + + /* color */ + + if (c->lighting_enabled) { + gl_shade_vertex(c, v); + } else { + v->color = c->current_color; + } + + /* tex coords */ + + if (c->texture_2d_enabled) { + if (c->apply_texture_matrix) { + gl_M4_MulV4(&v->tex_coord, c->matrix_stack_ptr[2], &c->current_tex_coord); + } else { + v->tex_coord = c->current_tex_coord; + } + } + /* precompute the mapping to the viewport */ + if (v->clip_code == 0) + gl_transform_to_viewport(c, v); + + /* edge flag */ + + v->edge_flag = c->current_edge_flag; + + switch (c->begin_type) { + case GL_POINTS: + gl_draw_point(c, &c->vertex[0]); + n = 0; + break; + + case GL_LINES: + if (n == 2) { + gl_draw_line(c, &c->vertex[0], &c->vertex[1]); + n = 0; + } + break; + case GL_LINE_STRIP: + case GL_LINE_LOOP: + if (n == 1) { + c->vertex[2] = c->vertex[0]; + } else if (n == 2) { + gl_draw_line(c, &c->vertex[0], &c->vertex[1]); + c->vertex[0] = c->vertex[1]; + n = 1; + } + break; + + case GL_TRIANGLES: + if (n == 3) { + gl_draw_triangle(c, &c->vertex[0], &c->vertex[1], &c->vertex[2]); + n = 0; + } + break; + case GL_TRIANGLE_STRIP: + if (cnt >= 3) { + if (n == 3) + n = 0; + /* needed to respect triangle orientation */ + switch(cnt & 1) { + case 0: + gl_draw_triangle(c,&c->vertex[2],&c->vertex[1],&c->vertex[0]); + break; + default: + case 1: + gl_draw_triangle(c,&c->vertex[0],&c->vertex[1],&c->vertex[2]); + break; + } + } + break; + case GL_TRIANGLE_FAN: + if (n == 3) { + gl_draw_triangle(c, &c->vertex[0], &c->vertex[1], &c->vertex[2]); + c->vertex[1] = c->vertex[2]; + n = 2; + } + break; + + case GL_QUADS: + if (n == 4) { + c->vertex[2].edge_flag = 0; + gl_draw_triangle(c, &c->vertex[0], &c->vertex[1], &c->vertex[2]); + c->vertex[2].edge_flag = 1; + c->vertex[0].edge_flag = 0; + gl_draw_triangle(c, &c->vertex[0], &c->vertex[2], &c->vertex[3]); + n = 0; + } + break; + + case GL_QUAD_STRIP: + if (n == 4) { + gl_draw_triangle(c, &c->vertex[0], &c->vertex[1], &c->vertex[2]); + gl_draw_triangle(c, &c->vertex[1], &c->vertex[3], &c->vertex[2]); + for (i = 0; i < 2; i++) + c->vertex[i] = c->vertex[i + 2]; + n = 2; + } + break; + case GL_POLYGON: + break; + default: + gl_fatal_error("glBegin: type %x not handled\n", c->begin_type); + } + + c->vertex_n = n; +} + +void glopEnd(GLContext * c, GLParam * param) +{ + assert(c->in_begin == 1); + + if (c->begin_type == GL_LINE_LOOP) { + if (c->vertex_cnt >= 3) { + gl_draw_line(c, &c->vertex[0], &c->vertex[2]); + } + } else if (c->begin_type == GL_POLYGON) { + int i = c->vertex_cnt; + while (i >= 3) { + i--; + gl_draw_triangle(c, &c->vertex[i], &c->vertex[0], &c->vertex[i - 1]); + } + } + c->in_begin = 0; +} diff --git a/programs/develop/libraries/TinyGL/src/zbuffer.c b/programs/develop/libraries/TinyGL/src/zbuffer.c new file mode 100644 index 0000000000..b55ed9ebca --- /dev/null +++ b/programs/develop/libraries/TinyGL/src/zbuffer.c @@ -0,0 +1,509 @@ +/* + + * Z buffer: 16 bits Z / 16 bits color + * + */ +#include +#include +/*#include */ +#include +#include "zbuffer.h" + +ZBuffer *ZB_open(int xsize, int ysize, int mode, + int nb_colors, + unsigned char *color_indexes, + int *color_table, + void *frame_buffer) +{ + ZBuffer *zb; + int size; + + zb = gl_malloc(sizeof(ZBuffer)); + if (zb == NULL) + return NULL; + + zb->xsize = xsize; + zb->ysize = ysize; + zb->mode = mode; + zb->linesize = (xsize * PSZB + 3) & ~3; + + switch (mode) { +#ifdef TGL_FEATURE_8_BITS + case ZB_MODE_INDEX: + ZB_initDither(zb, nb_colors, color_indexes, color_table); + break; +#endif +#ifdef TGL_FEATURE_32_BITS + case ZB_MODE_RGBA: +#endif +#ifdef TGL_FEATURE_24_BITS + case ZB_MODE_RGB24: +#endif + case ZB_MODE_5R6G5B: + zb->nb_colors = 0; + break; + default: + goto error; + } + + size = zb->xsize * zb->ysize * sizeof(unsigned short); + + zb->zbuf = gl_malloc(size); + if (zb->zbuf == NULL) + goto error; + + zb->frame_buffer_allocated = 0; + zb->pbuf = NULL; + + zb->current_texture = NULL; + + return zb; + error: + gl_free(zb); + return NULL; +} + +void ZB_close(ZBuffer * zb) +{ +#ifdef TGL_FEATURE_8_BITS + if (zb->mode == ZB_MODE_INDEX) + ZB_closeDither(zb); +#endif + + if (zb->frame_buffer_allocated) + gl_free(zb->pbuf); + + gl_free(zb->zbuf); + gl_free(zb); +} + +void ZB_resize(ZBuffer * zb, void *frame_buffer, int xsize, int ysize) +{ + int size; + + /* xsize must be a multiple of 4 */ + xsize = xsize & ~3; + + zb->xsize = xsize; + zb->ysize = ysize; + zb->linesize = (xsize * PSZB + 3) & ~3; + + size = zb->xsize * zb->ysize * sizeof(unsigned short); + + gl_free(zb->zbuf); + zb->zbuf = gl_malloc(size); + + if (zb->frame_buffer_allocated) + gl_free(zb->pbuf); + + if (frame_buffer == NULL) { + zb->pbuf = gl_malloc((zb->ysize+1) * (zb->linesize)); + zb->frame_buffer_allocated = 1; + } else { + zb->pbuf = frame_buffer; + zb->frame_buffer_allocated = 0; + } +} + +static void ZB_copyBuffer(ZBuffer * zb, + void *buf, + int linesize) +{ + unsigned char *p1; + PIXEL *q; + int y, n; + + q = zb->pbuf; + p1 = buf; + n = zb->xsize * PSZB; + for (y = 0; y < zb->ysize; y++) { + memcpy(p1, q, n); + p1 += linesize; + q = (PIXEL *) ((char *) q + zb->linesize); + } +} + +#if TGL_FEATURE_RENDER_BITS == 16 + +/* 32 bpp copy */ + +#ifdef TGL_FEATURE_32_BITS + +#define RGB16_TO_RGB32(p0,p1,v)\ +{\ + unsigned int g,b,gb;\ + g = (v & 0x07E007E0) << 5;\ + b = (v & 0x001F001F) << 3;\ + gb = g | b;\ + p0 = (gb & 0x0000FFFF) | ((v & 0x0000F800) << 8);\ + p1 = (gb >> 16) | ((v & 0xF8000000) >> 8);\ +} + +static void ZB_copyFrameBufferRGB32(ZBuffer * zb, + void *buf, + int linesize) +{ + unsigned short *q; + unsigned int *p, *p1, v, w0, w1; + int y, n; + + q = zb->pbuf; + p1 = (unsigned int *) buf; + + for (y = 0; y < zb->ysize; y++) { + p = p1; + n = zb->xsize >> 2; + do { + v = *(unsigned int *) q; +#if BYTE_ORDER == BIG_ENDIAN + RGB16_TO_RGB32(w1, w0, v); +#else + RGB16_TO_RGB32(w0, w1, v); +#endif + p[0] = w0; + p[1] = w1; + + v = *(unsigned int *) (q + 2); +#if BYTE_ORDER == BIG_ENDIAN + RGB16_TO_RGB32(w1, w0, v); +#else + RGB16_TO_RGB32(w0, w1, v); +#endif + p[2] = w0; + p[3] = w1; + + q += 4; + p += 4; + } while (--n > 0); + + p1 += linesize; + } +} + +#endif + +/* 24 bit packed pixel handling */ + +#ifdef TGL_FEATURE_24_BITS + +/* order: RGBR GBRG BRGB */ + +/* XXX: packed pixel 24 bit support not tested */ +/* XXX: big endian case not optimised */ + +#if BYTE_ORDER == BIG_ENDIAN + +#define RGB16_TO_RGB24(p0,p1,p2,v1,v2)\ +{\ + unsigned int r1,g1,b1,gb1,g2,b2,gb2;\ + v1 = (v1 << 16) | (v1 >> 16);\ + v2 = (v2 << 16) | (v2 >> 16);\ + r1 = (v1 & 0xF800F800);\ + g1 = (v1 & 0x07E007E0) << 5;\ + b1 = (v1 & 0x001F001F) << 3;\ + gb1 = g1 | b1;\ + p0 = ((gb1 & 0x0000FFFF) << 8) | (r1 << 16) | (r1 >> 24);\ + g2 = (v2 & 0x07E007E0) << 5;\ + b2 = (v2 & 0x001F001F) << 3;\ + gb2 = g2 | b2;\ + p1 = (gb1 & 0xFFFF0000) | (v2 & 0xF800) | ((gb2 >> 8) & 0xff);\ + p2 = (gb2 << 24) | ((v2 & 0xF8000000) >> 8) | (gb2 >> 16);\ +} + +#else + +#define RGB16_TO_RGB24(p0,p1,p2,v1,v2)\ +{\ + unsigned int r1,g1,b1,gb1,g2,b2,gb2;\ + r1 = (v1 & 0xF800F800);\ + g1 = (v1 & 0x07E007E0) << 5;\ + b1 = (v1 & 0x001F001F) << 3;\ + gb1 = g1 | b1;\ + p0 = ((gb1 & 0x0000FFFF) << 8) | (r1 << 16) | (r1 >> 24);\ + g2 = (v2 & 0x07E007E0) << 5;\ + b2 = (v2 & 0x001F001F) << 3;\ + gb2 = g2 | b2;\ + p1 = (gb1 & 0xFFFF0000) | (v2 & 0xF800) | ((gb2 >> 8) & 0xff);\ + p2 = (gb2 << 24) | ((v2 & 0xF8000000) >> 8) | (gb2 >> 16);\ +} + +#endif + +static void ZB_copyFrameBufferRGB24(ZBuffer * zb, + void *buf, + int linesize) +{ + unsigned short *q; + unsigned int *p, *p1, w0, w1, w2, v0, v1; + int y, n; + + q = zb->pbuf; + p1 = (unsigned int *) buf; + linesize = linesize * 3; + + for (y = 0; y < zb->ysize; y++) { + p = p1; + n = zb->xsize >> 2; + do { + v0 = *(unsigned int *) q; + v1 = *(unsigned int *) (q + 2); + RGB16_TO_RGB24(w0, w1, w2, v0, v1); + p[0] = w0; + p[1] = w1; + p[2] = w2; + + q += 4; + p += 3; + } while (--n > 0); + + (char *) p1 += linesize; + } +} + +#endif + +void ZB_copyFrameBuffer(ZBuffer * zb, void *buf, + int linesize) +{ + switch (zb->mode) { +#ifdef TGL_FEATURE_8_BITS + case ZB_MODE_INDEX: + ZB_ditherFrameBuffer(zb, buf, linesize >> 1); + break; +#endif +#ifdef TGL_FEATURE_16_BITS + case ZB_MODE_5R6G5B: + ZB_copyBuffer(zb, buf, linesize); + break; +#endif +#ifdef TGL_FEATURE_32_BITS + case ZB_MODE_RGBA: + ZB_copyFrameBufferRGB32(zb, buf, linesize >> 1); + break; +#endif +#ifdef TGL_FEATURE_24_BITS + case ZB_MODE_RGB24: + ZB_copyFrameBufferRGB24(zb, buf, linesize >> 1); + break; +#endif + default: + assert(0); + } +} + +#endif /* TGL_FEATURE_RENDER_BITS == 16 */ + +#if TGL_FEATURE_RENDER_BITS == 24 + +#define RGB24_TO_RGB16(r, g, b) \ + ((((r) >> 3) << 11) | (((g) >> 2) << 5) | ((b) >> 3)) + +/* XXX: not optimized */ +static void ZB_copyFrameBuffer5R6G5B(ZBuffer * zb, + void *buf, int linesize) +{ + PIXEL *q; + unsigned short *p, *p1; + int y, n; + + q = zb->pbuf; + p1 = (unsigned short *) buf; + + for (y = 0; y < zb->ysize; y++) { + p = p1; + n = zb->xsize >> 2; + do { + p[0] = RGB24_TO_RGB16(q[0], q[1], q[2]); + p[1] = RGB24_TO_RGB16(q[3], q[4], q[5]); + p[2] = RGB24_TO_RGB16(q[6], q[7], q[8]); + p[3] = RGB24_TO_RGB16(q[9], q[10], q[11]); + q = (PIXEL *)((char *)q + 4 * PSZB); + p += 4; + } while (--n > 0); + p1 = (unsigned short *)((char *)p1 + linesize); + } +} + +void ZB_copyFrameBuffer(ZBuffer * zb, void *buf, + int linesize) +{ + switch (zb->mode) { +#ifdef TGL_FEATURE_16_BITS + case ZB_MODE_5R6G5B: + ZB_copyFrameBuffer5R6G5B(zb, buf, linesize); + break; +#endif +#ifdef TGL_FEATURE_24_BITS + case ZB_MODE_RGB24: + ZB_copyBuffer(zb, buf, linesize); + break; +#endif + default: + assert(0); + } +} + +#endif /* TGL_FEATURE_RENDER_BITS == 24 */ + +#if TGL_FEATURE_RENDER_BITS == 32 + +#define RGB32_TO_RGB16(v) \ + (((v >> 8) & 0xf800) | (((v) >> 5) & 0x07e0) | (((v) & 0xff) >> 3)) + +/* XXX: not optimized */ +static void ZB_copyFrameBuffer5R6G5B(ZBuffer * zb, + void *buf, int linesize) +{ + PIXEL *q; + unsigned short *p, *p1; + int y, n; + + q = zb->pbuf; + p1 = (unsigned short *) buf; + + for (y = 0; y < zb->ysize; y++) { + p = p1; + n = zb->xsize >> 2; + do { + p[0] = RGB32_TO_RGB16(q[0]); + p[1] = RGB32_TO_RGB16(q[1]); + p[2] = RGB32_TO_RGB16(q[2]); + p[3] = RGB32_TO_RGB16(q[3]); + q += 4; + p += 4; + } while (--n > 0); + p1 = (unsigned short *)((char *)p1 + linesize); + } +} + +void ZB_copyFrameBuffer(ZBuffer * zb, void *buf, + int linesize) +{ + switch (zb->mode) { +#ifdef TGL_FEATURE_16_BITS + case ZB_MODE_5R6G5B: + ZB_copyFrameBuffer5R6G5B(zb, buf, linesize); + break; +#endif +#ifdef TGL_FEATURE_32_BITS + case ZB_MODE_RGBA: + ZB_copyBuffer(zb, buf, linesize); + break; +#endif + default: + assert(0); + } +} + +#endif /* TGL_FEATURE_RENDER_BITS == 32 */ + + +/* + * adr must be aligned on an 'int' + */ +void memset_s(void *adr, int val, int count) +{ + int i, n, v; + unsigned int *p; + unsigned short *q; + + p = adr; + v = val | (val << 16); + + n = count >> 3; + for (i = 0; i < n; i++) { + p[0] = v; + p[1] = v; + p[2] = v; + p[3] = v; + p += 4; + } + + q = (unsigned short *) p; + n = count & 7; + for (i = 0; i < n; i++) + *q++ = val; +} + +void memset_l(void *adr, int val, int count) +{ + int i, n, v; + unsigned int *p; + + p = adr; + v = val; + n = count >> 2; + for (i = 0; i < n; i++) { + p[0] = v; + p[1] = v; + p[2] = v; + p[3] = v; + p += 4; + } + + n = count & 3; + for (i = 0; i < n; i++) + *p++ = val; +} + +/* count must be a multiple of 4 and >= 4 */ +void memset_RGB24(void *adr,int r, int v, int b,long count) +{ + long i, n; + register long v1,v2,v3,*pt=(long *)(adr); + unsigned char *p,R=(unsigned char)r,V=(unsigned char)v,B=(unsigned char)b; + + p=(unsigned char *)adr; + *p++=R; + *p++=V; + *p++=B; + *p++=R; + *p++=V; + *p++=B; + *p++=R; + *p++=V; + *p++=B; + *p++=R; + *p++=V; + *p++=B; + v1=*pt++; + v2=*pt++; + v3=*pt++; + n = count >> 2; + for(i=1;izbuf, z, zb->xsize * zb->ysize); + } + if (clear_color) { + pp = zb->pbuf; + for (y = 0; y < zb->ysize; y++) { +#if TGL_FEATURE_RENDER_BITS == 15 || TGL_FEATURE_RENDER_BITS == 16 + color = RGB_TO_PIXEL(r, g, b); + memset_s(pp, color, zb->xsize); +#elif TGL_FEATURE_RENDER_BITS == 32 + color = RGB_TO_PIXEL(r, g, b); + memset_l(pp, color, zb->xsize); +#elif TGL_FEATURE_RENDER_BITS == 24 + memset_RGB24(pp,r>>8,g>>8,b>>8,zb->xsize); +#else +#error TODO +#endif + pp = (PIXEL *) ((char *) pp + zb->linesize); + } + } +} diff --git a/programs/develop/libraries/TinyGL/src/zbuffer.h b/programs/develop/libraries/TinyGL/src/zbuffer.h new file mode 100644 index 0000000000..02fede36aa --- /dev/null +++ b/programs/develop/libraries/TinyGL/src/zbuffer.h @@ -0,0 +1,169 @@ +#ifndef _tgl_zbuffer_h_ +#define _tgl_zbuffer_h_ + +/* + * Z buffer + */ + +#include "zfeatures.h" + +#define ZB_Z_BITS 16 + +#define ZB_POINT_Z_FRAC_BITS 14 + +#define ZB_POINT_S_MIN ( (1<<13) ) +#define ZB_POINT_S_MAX ( (1<<22)-(1<<13) ) +#define ZB_POINT_T_MIN ( (1<<21) ) +#define ZB_POINT_T_MAX ( (1<<30)-(1<<21) ) + +#define ZB_POINT_RED_MIN ( (1<<10) ) +#define ZB_POINT_RED_MAX ( (1<<16)-(1<<10) ) +#define ZB_POINT_GREEN_MIN ( (1<<9) ) +#define ZB_POINT_GREEN_MAX ( (1<<16)-(1<<9) ) +#define ZB_POINT_BLUE_MIN ( (1<<10) ) +#define ZB_POINT_BLUE_MAX ( (1<<16)-(1<<10) ) + +/* display modes */ +#define ZB_MODE_5R6G5B 1 /* true color 16 bits */ +#define ZB_MODE_INDEX 2 /* color index 8 bits */ +#define ZB_MODE_RGBA 3 /* 32 bit rgba mode */ +#define ZB_MODE_RGB24 4 /* 24 bit rgb mode */ +#define ZB_NB_COLORS 225 /* number of colors for 8 bit display */ + +#if TGL_FEATURE_RENDER_BITS == 15 + +#define RGB_TO_PIXEL(r,g,b) \ + ((((r) >> 1) & 0x7c00) | (((g) >> 6) & 0x03e0) | ((b) >> 11)) +typedef unsigned short PIXEL; +/* bytes per pixel */ +#define PSZB 2 +/* bits per pixel = (1 << PSZH) */ +#define PSZSH 4 + +#elif TGL_FEATURE_RENDER_BITS == 16 + +/* 16 bit mode */ +#define RGB_TO_PIXEL(r,g,b) \ + (((r) & 0xF800) | (((g) >> 5) & 0x07E0) | ((b) >> 11)) +typedef unsigned short PIXEL; +#define PSZB 2 +#define PSZSH 4 + +#elif TGL_FEATURE_RENDER_BITS == 24 + +#define RGB_TO_PIXEL(r,g,b) \ + ((((r) << 8) & 0xff0000) | ((g) & 0xff00) | ((b) >> 8)) +typedef unsigned char PIXEL; +#define PSZB 3 +#define PSZSH 5 + +#elif TGL_FEATURE_RENDER_BITS == 32 + +#define RGB_TO_PIXEL(r,g,b) \ + ((((r) << 8) & 0xff0000) | ((g) & 0xff00) | ((b) >> 8)) +typedef unsigned int PIXEL; +#define PSZB 4 +#define PSZSH 5 + +#else + +#error Incorrect number of bits per pixel + +#endif + +typedef struct { + int xsize,ysize; + int linesize; /* line size, in bytes */ + int mode; + + unsigned short *zbuf; + PIXEL *pbuf; + int frame_buffer_allocated; + + int nb_colors; + unsigned char *dctable; + int *ctable; + PIXEL *current_texture; +} ZBuffer; + +typedef struct { + int x,y,z; /* integer coordinates in the zbuffer */ + int s,t; /* coordinates for the mapping */ + int r,g,b; /* color indexes */ + + float sz,tz; /* temporary coordinates for mapping */ +} ZBufferPoint; + +/* zbuffer.c */ + +ZBuffer *ZB_open(int xsize,int ysize,int mode, + int nb_colors, + unsigned char *color_indexes, + int *color_table, + void *frame_buffer); + + +void ZB_close(ZBuffer *zb); + +void ZB_resize(ZBuffer *zb,void *frame_buffer,int xsize,int ysize); +void ZB_clear(ZBuffer *zb,int clear_z,int z, + int clear_color,int r,int g,int b); +/* linesize is in BYTES */ +void ZB_copyFrameBuffer(ZBuffer *zb,void *buf,int linesize); + +/* zdither.c */ + +void ZB_initDither(ZBuffer *zb,int nb_colors, + unsigned char *color_indexes,int *color_table); +void ZB_closeDither(ZBuffer *zb); +void ZB_ditherFrameBuffer(ZBuffer *zb,unsigned char *dest, + int linesize); + +/* zline.c */ + +void ZB_plot(ZBuffer *zb,ZBufferPoint *p); +void ZB_line(ZBuffer *zb,ZBufferPoint *p1,ZBufferPoint *p2); +void ZB_line_z(ZBuffer * zb, ZBufferPoint * p1, ZBufferPoint * p2); + +/* ztriangle.c */ + +void ZB_setTexture(ZBuffer *zb, PIXEL *texture); + +void ZB_fillTriangleFlat(ZBuffer *zb, + ZBufferPoint *p1,ZBufferPoint *p2,ZBufferPoint *p3); + +void ZB_fillTriangleSmooth(ZBuffer *zb, + ZBufferPoint *p1,ZBufferPoint *p2,ZBufferPoint *p3); + +void ZB_fillTriangleMapping(ZBuffer *zb, + ZBufferPoint *p1,ZBufferPoint *p2,ZBufferPoint *p3); + +void ZB_fillTriangleMappingPerspective(ZBuffer *zb, + ZBufferPoint *p0,ZBufferPoint *p1,ZBufferPoint *p2); + + +typedef void (*ZB_fillTriangleFunc)(ZBuffer *, + ZBufferPoint *,ZBufferPoint *,ZBufferPoint *); + +/* + * Memory allocator for TinyGL + */ + +/* modify these functions so that they suit your needs */ + +static inline void gl_free(void *p) +{ + free(p); +} + +static inline void *gl_malloc(int size) +{ + return malloc(size); +} + +static inline void *gl_zalloc(int size) +{ + return calloc(1, size); +} + +#endif /* _tgl_zbuffer_h_ */ diff --git a/programs/develop/libraries/TinyGL/src/zdither.c b/programs/develop/libraries/TinyGL/src/zdither.c new file mode 100644 index 0000000000..87db3e1b1e --- /dev/null +++ b/programs/develop/libraries/TinyGL/src/zdither.c @@ -0,0 +1,159 @@ +/* + * Highly optimised dithering 16 bits -> 8 bits. + * The formulas were taken in Mesa (Bob Mercier mercier@hollywood.cinenet.net). + */ + +#include +#include +#include "zbuffer.h" +/*#include */ + +#if defined(TGL_FEATURE_8_BITS) + +#define _R 5 +#define _G 9 +#define _B 5 +#define _DX 4 +#define _DY 4 +#define _D (_DX*_DY) +#define _MIX(r,g,b) ( ((g)<<6) | ((b)<<3) | (r) ) + +#define DITHER_TABLE_SIZE (1 << 15) + +#define DITHER_INDEX(r,g,b) ((b) + (g) * _B + (r) * (_B * _G)) + +#define MAXC 256 +static int kernel8[_DY*_DX] = { + 0 * MAXC, 8 * MAXC, 2 * MAXC, 10 * MAXC, + 12 * MAXC, 4 * MAXC, 14 * MAXC, 6 * MAXC, + 3 * MAXC, 11 * MAXC, 1 * MAXC, 9 * MAXC, + 15 * MAXC, 7 * MAXC, 13 * MAXC, 5 * MAXC, +}; + +/* we build the color table and the lookup table */ + +void ZB_initDither(ZBuffer *zb,int nb_colors, + unsigned char *color_indexes,int *color_table) +{ + int c,r,g,b,i,index,r1,g1,b1; + + if (nb_colors < (_R * _G * _B)) { + fprintf(stderr,"zdither: not enough colors\n"); + exit(1); + } + + for(i=0;inb_colors=nb_colors; + zb->ctable=gl_malloc(nb_colors * sizeof(int)); + + for (r = 0; r < _R; r++) { + for (g = 0; g < _G; g++) { + for (b = 0; b < _B; b++) { + r1=(r*255) / (_R - 1); + g1=(g*255) / (_G - 1); + b1=(b*255) / (_B - 1); + index=DITHER_INDEX(r,g,b); + c=(r1 << 16) | (g1 << 8) | b1; + zb->ctable[index]=c; + color_table[index]=c; + } + } + } + + zb->dctable=gl_malloc( DITHER_TABLE_SIZE ); + + for(i=0;i> 12) & 0x7; + g=(i >> 8) & 0xF; + b=(i >> 3) & 0x7; + index=DITHER_INDEX(r,g,b); + zb->dctable[i]=color_indexes[index]; + } +} + +void ZB_closeDither(ZBuffer *zb) +{ + gl_free(zb->ctable); + gl_free(zb->dctable); +} + +#if 0 +int ZDither_lookupColor(int r,int g,int b) +{ + unsigned char *ctable=zdither_color_table; + return ctable[_MIX(_DITH0(_R, r), _DITH0(_G, g),_DITH0(_B, b))]; +} +#endif + + +#define DITHER_PIXEL2(a) \ +{ \ + register int v,t,r,g,c; \ + v=*(unsigned int *)(pp+(a)); \ + g=(v & 0x07DF07DF) + g_d; \ + r=(((v & 0xF800F800) >> 2) + r_d) & 0x70007000; \ + t=r | g; \ + c=ctable[t & 0xFFFF] | (ctable[t >> 16] << 8); \ + *(unsigned short *)(dest+(a))=c; \ +} + +/* NOTE: all the memory access are 16 bit aligned, so if buf or + linesize are not multiple of 2, it cannot work efficiently (or + hang!) */ + +void ZB_ditherFrameBuffer(ZBuffer *zb,unsigned char *buf, + int linesize) +{ + int xk,yk,x,y,c1,c2; + unsigned char *dest1; + unsigned short *pp1; + int r_d,g_d,b_d; + unsigned char *ctable=zb->dctable; + register unsigned char *dest; + register unsigned short *pp; + + assert( ((long)buf & 1) == 0 && (linesize & 1) == 0); + + for(yk=0;yk<4;yk++) { + for(xk=0;xk<4;xk+=2) { +#if BYTE_ORDER == BIG_ENDIAN + c1=kernel8[yk*4+xk+1]; + c2=kernel8[yk*4+xk]; +#else + c1=kernel8[yk*4+xk]; + c2=kernel8[yk*4+xk+1]; +#endif + r_d=((c1 << 2) & 0xF800) >> 2; + g_d=(c1 >> 4) & 0x07C0; + b_d=(c1 >> 9) & 0x001F; + + r_d|=(((c2 << 2) & 0xF800) >> 2) << 16; + g_d|=((c2 >> 4) & 0x07C0) << 16; + b_d|=((c2 >> 9) & 0x001F) << 16; + g_d=b_d | g_d; + + dest1=buf + (yk * linesize) + xk; + pp1=zb->pbuf + (yk * zb->xsize) + xk; + + for(y=yk;yysize;y+=4) { + dest=dest1; + pp=pp1; + for(x=xk;xxsize;x+=16) { + + DITHER_PIXEL2(0); + DITHER_PIXEL2(1*4); + DITHER_PIXEL2(2*4); + DITHER_PIXEL2(3*4); + + pp+=16; + dest+=16; + } + dest1+=linesize*4; + pp1+=zb->xsize*4; + } + } + } +} + +#endif diff --git a/programs/develop/libraries/TinyGL/src/zfeatures.h b/programs/develop/libraries/TinyGL/src/zfeatures.h new file mode 100644 index 0000000000..356587ddb0 --- /dev/null +++ b/programs/develop/libraries/TinyGL/src/zfeatures.h @@ -0,0 +1,54 @@ +#ifndef _tgl_features_h_ +#define _tgl_features_h_ + +#define NDEBUG +/*for menuetlibc*/ +#ifdef NDEBUG +/* + * If not debugging, assert does nothing. + */ +#define assert(x) ((void)0) +#else /* debugging enabled */ +#include +#endif + +/* It is possible to enable/disable (compile time) features in this + header file. */ + +/*#define TGL_FEATURE_ARRAYS 1*/ +/*#define TGL_FEATURE_DISPLAYLISTS 1*/ +/*#define TGL_FEATURE_POLYGON_OFFSET 1*/ + +/* + * Matrix of internal and external pixel formats supported. 'Y' means + * supported. + * + * External 8 16 24 32 + * Internal + * 15 . . . . + * 16 Y Y Y Y + * 24 . Y Y . + * 32 . Y . Y + * + * + * 15 bpp does not work yet (although it is easy to add it - ask me if + * you need it). + * + * Internal pixel format: see TGL_FEATURE_RENDER_BITS + * External pixel format: see TGL_FEATURE_xxx_BITS + */ + +/* enable various convertion code from internal pixel format (usually + 16 bits per pixel) to any external format */ +/*#define TGL_FEATURE_16_BITS 1*/ +/*#define TGL_FEATURE_8_BITS 1*/ +#define TGL_FEATURE_24_BITS 1 +/*#define TGL_FEATURE_32_BITS 1*/ + + +/*#define TGL_FEATURE_RENDER_BITS 15*/ +/*#define TGL_FEATURE_RENDER_BITS 16*/ +#define TGL_FEATURE_RENDER_BITS 24 +/*#define TGL_FEATURE_RENDER_BITS 32*/ + +#endif /* _tgl_features_h_ */ diff --git a/programs/develop/libraries/TinyGL/src/zgl.h b/programs/develop/libraries/TinyGL/src/zgl.h new file mode 100644 index 0000000000..ab03e82464 --- /dev/null +++ b/programs/develop/libraries/TinyGL/src/zgl.h @@ -0,0 +1,392 @@ +#ifndef _tgl_zgl_h_ +#define _tgl_zgl_h_ + +#include +#include +#include +/*#include */ +#include +#include "zbuffer.h" +#include "zmath.h" +#include "zfeatures.h" + +#define fputc(...) /*nothing*/ +#define fprintf(...) /*nothing*/ +#define vfprintf(...) /*nothing*/ +#undef stderr +#define stderr ((FILE*)-1) + + +/*#define DEBUG */ +/*#define NDEBUG */ + +enum { + +#define ADD_OP(a,b,c) OP_ ## a , + +#include "opinfo.h" + +}; + +/* initially # of allocated GLVertexes (will grow when necessary) */ +#define POLYGON_MAX_VERTEX 16 + +/* Max # of specular light pow buffers */ +#define MAX_SPECULAR_BUFFERS 8 +/* # of entries in specular buffer */ +#define SPECULAR_BUFFER_SIZE 1024 +/* specular buffer granularity */ +#define SPECULAR_BUFFER_RESOLUTION 1024 + + +#define MAX_MODELVIEW_STACK_DEPTH 32 +#define MAX_PROJECTION_STACK_DEPTH 8 +#define MAX_TEXTURE_STACK_DEPTH 8 +#define MAX_NAME_STACK_DEPTH 64 +#define MAX_TEXTURE_LEVELS 11 +#define MAX_LIGHTS 16 + +#define VERTEX_HASH_SIZE 1031 + +#define MAX_DISPLAY_LISTS 1024 +#define OP_BUFFER_MAX_SIZE 512 + +#define TGL_OFFSET_FILL 0x1 +#define TGL_OFFSET_LINE 0x2 +#define TGL_OFFSET_POINT 0x4 + +typedef struct GLSpecBuf { + int shininess_i; + int last_used; + float buf[SPECULAR_BUFFER_SIZE+1]; + struct GLSpecBuf *next; +} GLSpecBuf; + +typedef struct GLLight { + V4 ambient; + V4 diffuse; + V4 specular; + V4 position; + V3 spot_direction; + float spot_exponent; + float spot_cutoff; + float attenuation[3]; + /* precomputed values */ + float cos_spot_cutoff; + V3 norm_spot_direction; + V3 norm_position; + /* we use a linked list to know which are the enabled lights */ + int enabled; + struct GLLight *next,*prev; +} GLLight; + +typedef struct GLMaterial { + V4 emission; + V4 ambient; + V4 diffuse; + V4 specular; + float shininess; + + /* computed values */ + int shininess_i; + int do_specular; +} GLMaterial; + + +typedef struct GLViewport { + int xmin,ymin,xsize,ysize; + V3 scale; + V3 trans; + int updated; +} GLViewport; + +typedef union { + int op; + float f; + int i; + unsigned int ui; + void *p; +} GLParam; + +typedef struct GLParamBuffer { + GLParam ops[OP_BUFFER_MAX_SIZE]; + struct GLParamBuffer *next; +} GLParamBuffer; + +typedef struct GLList { + GLParamBuffer *first_op_buffer; + /* TODO: extensions for an hash table or a better allocating scheme */ +} GLList; + +typedef struct GLVertex { + int edge_flag; + V3 normal; + V4 coord; + V4 tex_coord; + V4 color; + + /* computed values */ + V4 ec; /* eye coordinates */ + V4 pc; /* coordinates in the normalized volume */ + int clip_code; /* clip code */ + ZBufferPoint zp; /* integer coordinates for the rasterization */ +} GLVertex; + +typedef struct GLImage { + void *pixmap; + int xsize,ysize; +} GLImage; + +/* textures */ + +#define TEXTURE_HASH_TABLE_SIZE 256 + +typedef struct GLTexture { + GLImage images[MAX_TEXTURE_LEVELS]; + int handle; + struct GLTexture *next,*prev; +} GLTexture; + + +/* shared state */ + +typedef struct GLSharedState { + GLList **lists; + GLTexture **texture_hash_table; +} GLSharedState; + +struct GLContext; + +typedef void (*gl_draw_triangle_func)(struct GLContext *c, + GLVertex *p0,GLVertex *p1,GLVertex *p2); + +/* display context */ + +typedef struct GLContext { + /* Z buffer */ + ZBuffer *zb; + + /* lights */ + GLLight lights[MAX_LIGHTS]; + GLLight *first_light; + V4 ambient_light_model; + int local_light_model; + int lighting_enabled; + int light_model_two_side; + + /* materials */ + GLMaterial materials[2]; + int color_material_enabled; + int current_color_material_mode; + int current_color_material_type; + + /* textures */ + GLTexture *current_texture; + int texture_2d_enabled; + + /* shared state */ + GLSharedState shared_state; + + /* current list */ + GLParamBuffer *current_op_buffer; + int current_op_buffer_index; + int exec_flag,compile_flag,print_flag; + + /* matrix */ + + int matrix_mode; + M4 *matrix_stack[3]; + M4 *matrix_stack_ptr[3]; + int matrix_stack_depth_max[3]; + + M4 matrix_model_view_inv; + M4 matrix_model_projection; + int matrix_model_projection_updated; + int matrix_model_projection_no_w_transform; + int apply_texture_matrix; + + /* viewport */ + GLViewport viewport; + + /* current state */ + int polygon_mode_back; + int polygon_mode_front; + + int current_front_face; + int current_shade_model; + int current_cull_face; + int cull_face_enabled; + int normalize_enabled; + gl_draw_triangle_func draw_triangle_front,draw_triangle_back; + + /* selection */ + int render_mode; + unsigned int *select_buffer; + int select_size; + unsigned int *select_ptr,*select_hit; + int select_overflow; + int select_hits; + + /* names */ + unsigned int name_stack[MAX_NAME_STACK_DEPTH]; + int name_stack_size; + + /* clear */ + float clear_depth; + V4 clear_color; + + /* current vertex state */ + V4 current_color; + unsigned int longcurrent_color[3]; /* precomputed integer color */ + V4 current_normal; + V4 current_tex_coord; + int current_edge_flag; + + /* glBegin / glEnd */ + int in_begin; + int begin_type; + int vertex_n,vertex_cnt; + int vertex_max; + GLVertex *vertex; + + /* opengl 1.1 arrays */ + float *vertex_array; + int vertex_array_size; + int vertex_array_stride; + float *normal_array; + int normal_array_stride; + float *color_array; + int color_array_size; + int color_array_stride; + float *texcoord_array; + int texcoord_array_size; + int texcoord_array_stride; + int client_states; + + /* opengl 1.1 polygon offset */ + float offset_factor; + float offset_units; + int offset_states; + + /* specular buffer. could probably be shared between contexts, + but that wouldn't be 100% thread safe */ + GLSpecBuf *specbuf_first; + int specbuf_used_counter; + int specbuf_num_buffers; + + /* opaque structure for user's use */ + void *opaque; + /* resize viewport function */ + int (*gl_resize_viewport)(struct GLContext *c,int *xsize,int *ysize); + + /* depth test */ + int depth_test; +} GLContext; + +extern GLContext *gl_ctx; + +void gl_add_op(GLParam *p); + +/* clip.c */ +void gl_transform_to_viewport(GLContext *c,GLVertex *v); +void gl_draw_triangle(GLContext *c,GLVertex *p0,GLVertex *p1,GLVertex *p2); +void gl_draw_line(GLContext *c,GLVertex *p0,GLVertex *p1); +void gl_draw_point(GLContext *c,GLVertex *p0); + +void gl_draw_triangle_point(GLContext *c, + GLVertex *p0,GLVertex *p1,GLVertex *p2); +void gl_draw_triangle_line(GLContext *c, + GLVertex *p0,GLVertex *p1,GLVertex *p2); +void gl_draw_triangle_fill(GLContext *c, + GLVertex *p0,GLVertex *p1,GLVertex *p2); +void gl_draw_triangle_select(GLContext *c, + GLVertex *p0,GLVertex *p1,GLVertex *p2); + +/* matrix.c */ +void gl_print_matrix(const float *m); +/* +void glopLoadIdentity(GLContext *c,GLParam *p); +void glopTranslate(GLContext *c,GLParam *p);*/ + +/* light.c */ +void gl_add_select(GLContext *c,unsigned int zmin,unsigned int zmax); +void gl_enable_disable_light(GLContext *c,int light,int v); +void gl_shade_vertex(GLContext *c,GLVertex *v); + +void glInitTextures(GLContext *c); +void glEndTextures(GLContext *c); +GLTexture *alloc_texture(GLContext *c,int h); + +/* image_util.c */ +void gl_convertRGB_to_5R6G5B(unsigned short *pixmap,unsigned char *rgb, + int xsize,int ysize); +void gl_convertRGB_to_8A8R8G8B(unsigned int *pixmap, unsigned char *rgb, + int xsize, int ysize); +void gl_resizeImage(unsigned char *dest,int xsize_dest,int ysize_dest, + unsigned char *src,int xsize_src,int ysize_src); +void gl_resizeImageNoInterpolate(unsigned char *dest,int xsize_dest,int ysize_dest, + unsigned char *src,int xsize_src,int ysize_src); + +static inline GLContext *gl_get_context(void) +{ + return gl_ctx; +}; + +void gl_fatal_error(char *format, ...); + + +/* specular buffer "api" */ +GLSpecBuf *specbuf_get_buffer(GLContext *c, const int shininess_i, + const float shininess); + +#ifdef __BEOS__ +void dprintf(const char *, ...); + +#else /* !BEOS */ + +#ifdef DEBUG + +#define dprintf(format, args...) \ + fprintf(stderr,"In '%s': " format "\n",__FUNCTION__, ##args); + +#else + +#define dprintf(format, args...) + +#endif +#endif /* !BEOS */ + +/* glopXXX functions */ + +#define ADD_OP(a,b,c) void glop ## a (GLContext *,GLParam *); +#include "opinfo.h" + +/* this clip epsilon is needed to avoid some rounding errors after + several clipping stages */ + +#define CLIP_EPSILON (1E-5) + +static inline int gl_clipcode(float x,float y,float z,float w1) +{ + float w; + + w=w1 * (1.0 + CLIP_EPSILON); + return (x<-w) | + ((x>w)<<1) | + ((y<-w)<<2) | + ((y>w)<<3) | + ((z<-w)<<4) | + ((z>w)<<5) ; +} + +#define RGBFtoRGBI(rf,gf,bf,ri,gi,bi) \ +{\ + ri = (unsigned int) (rf * (ZB_POINT_RED_MAX - ZB_POINT_RED_MIN) + \ + ZB_POINT_RED_MIN); \ + gi = (unsigned int) (gf * (ZB_POINT_GREEN_MAX - ZB_POINT_GREEN_MIN) + \ + ZB_POINT_GREEN_MIN); \ + bi = (unsigned int) (bf * (ZB_POINT_BLUE_MAX - ZB_POINT_BLUE_MIN) + \ + ZB_POINT_BLUE_MIN);\ +} + +#endif /* _tgl_zgl_h_ */ diff --git a/programs/develop/libraries/TinyGL/src/zline.c b/programs/develop/libraries/TinyGL/src/zline.c new file mode 100644 index 0000000000..561064b0c2 --- /dev/null +++ b/programs/develop/libraries/TinyGL/src/zline.c @@ -0,0 +1,84 @@ +#include +#include "zbuffer.h" + +#define ZCMP(z,zpix) ((z) >= (zpix)) + +void ZB_plot(ZBuffer * zb, ZBufferPoint * p) +{ + unsigned short *pz; + PIXEL *pp; + int zz; + + pz = zb->zbuf + (p->y * zb->xsize + p->x); + pp = (PIXEL *) ((char *) zb->pbuf + zb->linesize * p->y + p->x * PSZB); + zz = p->z >> ZB_POINT_Z_FRAC_BITS; + if (ZCMP(zz, *pz)) { +#if TGL_FEATURE_RENDER_BITS == 24 + pp[0]=p->r>>8; + pp[1]=p->g>>8; + pp[2]=p->b>>8; +#else + *pp = RGB_TO_PIXEL(p->r, p->g, p->b); +#endif + *pz = zz; + } +} + +#define INTERP_Z +static void ZB_line_flat_z(ZBuffer * zb, ZBufferPoint * p1, ZBufferPoint * p2, + int color) +{ +#include "zline.h" +} + +/* line with color interpolation */ +#define INTERP_Z +#define INTERP_RGB +static void ZB_line_interp_z(ZBuffer * zb, ZBufferPoint * p1, ZBufferPoint * p2) +{ +#include "zline.h" +} + +/* no Z interpolation */ + +static void ZB_line_flat(ZBuffer * zb, ZBufferPoint * p1, ZBufferPoint * p2, + int color) +{ +#include "zline.h" +} + +#define INTERP_RGB +static void ZB_line_interp(ZBuffer * zb, ZBufferPoint * p1, ZBufferPoint * p2) +{ +#include "zline.h" +} + +void ZB_line_z(ZBuffer * zb, ZBufferPoint * p1, ZBufferPoint * p2) +{ + int color1, color2; + + color1 = RGB_TO_PIXEL(p1->r, p1->g, p1->b); + color2 = RGB_TO_PIXEL(p2->r, p2->g, p2->b); + + /* choose if the line should have its color interpolated or not */ + if (color1 == color2) { + ZB_line_flat_z(zb, p1, p2, color1); + } else { + ZB_line_interp_z(zb, p1, p2); + } +} + +void ZB_line(ZBuffer * zb, ZBufferPoint * p1, ZBufferPoint * p2) +{ + int color1, color2; + + color1 = RGB_TO_PIXEL(p1->r, p1->g, p1->b); + color2 = RGB_TO_PIXEL(p2->r, p2->g, p2->b); + + /* choose if the line should have its color interpolated or not */ + if (color1 == color2) { + ZB_line_flat(zb, p1, p2, color1); + } else { + ZB_line_interp(zb, p1, p2); + } +} diff --git a/programs/develop/libraries/TinyGL/src/zline.h b/programs/develop/libraries/TinyGL/src/zline.h new file mode 100644 index 0000000000..c6c73dacac --- /dev/null +++ b/programs/develop/libraries/TinyGL/src/zline.h @@ -0,0 +1,121 @@ +{ + int n, dx, dy, sx, pp_inc_1, pp_inc_2; + register int a; + register PIXEL *pp; +#if defined(INTERP_RGB) || TGL_FEATURE_RENDER_BITS == 24 + register unsigned int r, g, b; +#endif +#ifdef INTERP_RGB + register unsigned int rinc, ginc, binc; +#endif +#ifdef INTERP_Z + register unsigned short *pz; + int zinc; + register int z, zz; +#endif + + if (p1->y > p2->y || (p1->y == p2->y && p1->x > p2->x)) { + ZBufferPoint *tmp; + tmp = p1; + p1 = p2; + p2 = tmp; + } + sx = zb->xsize; + pp = (PIXEL *) ((char *) zb->pbuf + zb->linesize * p1->y + p1->x * PSZB); +#ifdef INTERP_Z + pz = zb->zbuf + (p1->y * sx + p1->x); + z = p1->z; +#endif + + dx = p2->x - p1->x; + dy = p2->y - p1->y; +#ifdef INTERP_RGB + r = p1->r << 8; + g = p1->g << 8; + b = p1->b << 8; +#elif TGL_FEATURE_RENDER_BITS == 24 + /* for 24 bits, we store the colors in different variables */ + r = p2->r >> 8; + g = p2->g >> 8; + b = p2->b >> 8; +#endif + +#ifdef INTERP_RGB +#define RGB(x) x +#if TGL_FEATURE_RENDER_BITS == 24 +#define RGBPIXEL pp[0] = r >> 16, pp[1] = g >> 16, pp[2] = b >> 16 +#else +#define RGBPIXEL *pp = RGB_TO_PIXEL(r >> 8,g >> 8,b >> 8) +#endif +#else /* INTERP_RGB */ +#define RGB(x) +#if TGL_FEATURE_RENDER_BITS == 24 +#define RGBPIXEL pp[0] = r, pp[1] = g, pp[2] = b +#else +#define RGBPIXEL *pp = color +#endif +#endif /* INTERP_RGB */ + +#ifdef INTERP_Z +#define ZZ(x) x +#define PUTPIXEL() \ + { \ + zz=z >> ZB_POINT_Z_FRAC_BITS; \ + if (ZCMP(zz,*pz)) { \ + RGBPIXEL; \ + *pz=zz; \ + } \ + } +#else /* INTERP_Z */ +#define ZZ(x) +#define PUTPIXEL() RGBPIXEL +#endif /* INTERP_Z */ + +#define DRAWLINE(dx,dy,inc_1,inc_2) \ + n=dx;\ + ZZ(zinc=(p2->z-p1->z)/n);\ + RGB(rinc=((p2->r-p1->r) << 8)/n;\ + ginc=((p2->g-p1->g) << 8)/n;\ + binc=((p2->b-p1->b) << 8)/n);\ + a=2*dy-dx;\ + dy=2*dy;\ + dx=2*dx-dy;\ + pp_inc_1 = (inc_1) * PSZB;\ + pp_inc_2 = (inc_2) * PSZB;\ + do {\ + PUTPIXEL();\ + ZZ(z+=zinc);\ + RGB(r+=rinc;g+=ginc;b+=binc);\ + if (a>0) { pp=(PIXEL *)((char *)pp + pp_inc_1); ZZ(pz+=(inc_1)); a-=dx; }\ + else { pp=(PIXEL *)((char *)pp + pp_inc_2); ZZ(pz+=(inc_2)); a+=dy; }\ + } while (--n >= 0); + +/* fin macro */ + + if (dx == 0 && dy == 0) { + PUTPIXEL(); + } else if (dx > 0) { + if (dx >= dy) { + DRAWLINE(dx, dy, sx + 1, 1); + } else { + DRAWLINE(dy, dx, sx + 1, sx); + } + } else { + dx = -dx; + if (dx >= dy) { + DRAWLINE(dx, dy, sx - 1, -1); + } else { + DRAWLINE(dy, dx, sx - 1, sx); + } + } +} + +#undef INTERP_Z +#undef INTERP_RGB + +/* internal defines */ +#undef DRAWLINE +#undef PUTPIXEL +#undef ZZ +#undef RGB +#undef RGBPIXEL diff --git a/programs/develop/libraries/TinyGL/src/zmath.c b/programs/develop/libraries/TinyGL/src/zmath.c new file mode 100644 index 0000000000..c4945105f5 --- /dev/null +++ b/programs/develop/libraries/TinyGL/src/zmath.c @@ -0,0 +1,274 @@ +/* Some simple mathematical functions. Don't look for some logic in + the function names :-) */ + +#include +#include +#include +#include "zmath.h" + + +/* ******* Gestion des matrices 4x4 ****** */ + +void gl_M4_Id(M4 *a) +{ + int i,j; + for(i=0;i<4;i++) + for(j=0;j<4;j++) + if (i==j) a->m[i][j]=1.0; else a->m[i][j]=0.0; +} + +int gl_M4_IsId(M4 *a) +{ + int i,j; + for(i=0;i<4;i++) + for(j=0;j<4;j++) { + if (i==j) { + if (a->m[i][j] != 1.0) return 0; + } else if (a->m[i][j] != 0.0) return 0; + } + return 1; +} + +void gl_M4_Mul(M4 *c,M4 *a,M4 *b) +{ + int i,j,k; + float s; + for(i=0;i<4;i++) + for(j=0;j<4;j++) { + s=0.0; + for(k=0;k<4;k++) s+=a->m[i][k]*b->m[k][j]; + c->m[i][j]=s; + } +} + +/* c=c*a */ +void gl_M4_MulLeft(M4 *c,M4 *b) +{ + int i,j,k; + float s; + M4 a; + + /*memcpy(&a, c, 16*sizeof(float)); + */ + a=*c; + + for(i=0;i<4;i++) + for(j=0;j<4;j++) { + s=0.0; + for(k=0;k<4;k++) s+=a.m[i][k]*b->m[k][j]; + c->m[i][j]=s; + } +} + +void gl_M4_Move(M4 *a,M4 *b) +{ + memcpy(a,b,sizeof(M4)); +} + +void gl_MoveV3(V3 *a,V3 *b) +{ + memcpy(a,b,sizeof(V3)); +} + + +void gl_MulM4V3(V3 *a,M4 *b,V3 *c) +{ + a->X=b->m[0][0]*c->X+b->m[0][1]*c->Y+b->m[0][2]*c->Z+b->m[0][3]; + a->Y=b->m[1][0]*c->X+b->m[1][1]*c->Y+b->m[1][2]*c->Z+b->m[1][3]; + a->Z=b->m[2][0]*c->X+b->m[2][1]*c->Y+b->m[2][2]*c->Z+b->m[2][3]; +} + +void gl_MulM3V3(V3 *a,M4 *b,V3 *c) +{ + a->X=b->m[0][0]*c->X+b->m[0][1]*c->Y+b->m[0][2]*c->Z; + a->Y=b->m[1][0]*c->X+b->m[1][1]*c->Y+b->m[1][2]*c->Z; + a->Z=b->m[2][0]*c->X+b->m[2][1]*c->Y+b->m[2][2]*c->Z; +} + +void gl_M4_MulV4(V4 *a,M4 *b,V4 *c) +{ + a->X=b->m[0][0]*c->X+b->m[0][1]*c->Y+b->m[0][2]*c->Z+b->m[0][3]*c->W; + a->Y=b->m[1][0]*c->X+b->m[1][1]*c->Y+b->m[1][2]*c->Z+b->m[1][3]*c->W; + a->Z=b->m[2][0]*c->X+b->m[2][1]*c->Y+b->m[2][2]*c->Z+b->m[2][3]*c->W; + a->W=b->m[3][0]*c->X+b->m[3][1]*c->Y+b->m[3][2]*c->Z+b->m[3][3]*c->W; +} + +/* transposition of a 4x4 matrix */ +void gl_M4_Transpose(M4 *a,M4 *b) +{ + a->m[0][0]=b->m[0][0]; + a->m[0][1]=b->m[1][0]; + a->m[0][2]=b->m[2][0]; + a->m[0][3]=b->m[3][0]; + + a->m[1][0]=b->m[0][1]; + a->m[1][1]=b->m[1][1]; + a->m[1][2]=b->m[2][1]; + a->m[1][3]=b->m[3][1]; + + a->m[2][0]=b->m[0][2]; + a->m[2][1]=b->m[1][2]; + a->m[2][2]=b->m[2][2]; + a->m[2][3]=b->m[3][2]; + + a->m[3][0]=b->m[0][3]; + a->m[3][1]=b->m[1][3]; + a->m[3][2]=b->m[2][3]; + a->m[3][3]=b->m[3][3]; +} + +/* inversion of an orthogonal matrix of type Y=M.X+P */ +void gl_M4_InvOrtho(M4 *a,M4 b) +{ + int i,j; + float s; + for(i=0;i<3;i++) + for(j=0;j<3;j++) a->m[i][j]=b.m[j][i]; + a->m[3][0]=0.0; a->m[3][1]=0.0; a->m[3][2]=0.0; a->m[3][3]=1.0; + for(i=0;i<3;i++) { + s=0; + for(j=0;j<3;j++) s-=b.m[j][i]*b.m[j][3]; + a->m[i][3]=s; + } +} + +/* Inversion of a general nxn matrix. + Note : m is destroyed */ + +int Matrix_Inv(float *r,float *m,int n) +{ + int i,j,k,l; + float max,tmp,t; + + /* identite dans r */ + for(i=0;ifabs(max)) { + k=i; + max=m[i*n+j]; + } + + /* non intersible matrix */ + if (max==0) return 1; + + + /* permutation des lignes j et k */ + if (k!=j) { + for(i=0;im[0][0],&tmp.m[0][0],4); +} + +void gl_M4_Rotate(M4 *a,float t,int u) +{ + float s,c; + int v,w; + if ((v=u+1)>2) v=0; + if ((w=v+1)>2) w=0; + s=sin(t); + c=cos(t); + gl_M4_Id(a); + a->m[v][v]=c; a->m[v][w]=-s; + a->m[w][v]=s; a->m[w][w]=c; +} + + +/* inverse of a 3x3 matrix */ +void gl_M3_Inv(M3 *a,M3 *m) +{ + float det; + + det = m->m[0][0]*m->m[1][1]*m->m[2][2]-m->m[0][0]*m->m[1][2]*m->m[2][1]- + m->m[1][0]*m->m[0][1]*m->m[2][2]+m->m[1][0]*m->m[0][2]*m->m[2][1]+ + m->m[2][0]*m->m[0][1]*m->m[1][2]-m->m[2][0]*m->m[0][2]*m->m[1][1]; + + a->m[0][0] = (m->m[1][1]*m->m[2][2]-m->m[1][2]*m->m[2][1])/det; + a->m[0][1] = -(m->m[0][1]*m->m[2][2]-m->m[0][2]*m->m[2][1])/det; + a->m[0][2] = -(-m->m[0][1]*m->m[1][2]+m->m[0][2]*m->m[1][1])/det; + + a->m[1][0] = -(m->m[1][0]*m->m[2][2]-m->m[1][2]*m->m[2][0])/det; + a->m[1][1] = (m->m[0][0]*m->m[2][2]-m->m[0][2]*m->m[2][0])/det; + a->m[1][2] = -(m->m[0][0]*m->m[1][2]-m->m[0][2]*m->m[1][0])/det; + + a->m[2][0] = (m->m[1][0]*m->m[2][1]-m->m[1][1]*m->m[2][0])/det; + a->m[2][1] = -(m->m[0][0]*m->m[2][1]-m->m[0][1]*m->m[2][0])/det; + a->m[2][2] = (m->m[0][0]*m->m[1][1]-m->m[0][1]*m->m[1][0])/det; +} + + +/* vector arithmetic */ + +int gl_V3_Norm(V3 *a) +{ + float n; + n=sqrt(a->X*a->X+a->Y*a->Y+a->Z*a->Z); + if (n==0) return 1; + a->X/=n; + a->Y/=n; + a->Z/=n; + return 0; +} + +V3 gl_V3_New(float x,float y,float z) +{ + V3 a; + a.X=x; + a.Y=y; + a.Z=z; + return a; +} + +V4 gl_V4_New(float x,float y,float z,float w) +{ + V4 a; + a.X=x; + a.Y=y; + a.Z=z; + a.W=w; + return a; +} + + diff --git a/programs/develop/libraries/TinyGL/src/zmath.h b/programs/develop/libraries/TinyGL/src/zmath.h new file mode 100644 index 0000000000..e8fb50bee3 --- /dev/null +++ b/programs/develop/libraries/TinyGL/src/zmath.h @@ -0,0 +1,56 @@ +#ifndef __ZMATH__ +#define __ZMATH__ + +/*for menuetlibc*/ +#define pow powf + +/* Matrix & Vertex */ + +typedef struct { + float m[4][4]; +} M4; + +typedef struct { + float m[3][3]; +} M3; + +typedef struct { + float m[3][4]; +} M34; + + +#define X v[0] +#define Y v[1] +#define Z v[2] +#define W v[3] + +typedef struct { + float v[3]; +} V3; + +typedef struct { + float v[4]; +} V4; + +void gl_M4_Id(M4 *a); +int gl_M4_IsId(M4 *a); +void gl_M4_Move(M4 *a,M4 *b); +void gl_MoveV3(V3 *a,V3 *b); +void gl_MulM4V3(V3 *a,M4 *b,V3 *c); +void gl_MulM3V3(V3 *a,M4 *b,V3 *c); + +void gl_M4_MulV4(V4 * a,M4 *b,V4 * c); +void gl_M4_InvOrtho(M4 *a,M4 b); +void gl_M4_Inv(M4 *a,M4 *b); +void gl_M4_Mul(M4 *c,M4 *a,M4 *b); +void gl_M4_MulLeft(M4 *c,M4 *a); +void gl_M4_Transpose(M4 *a,M4 *b); +void gl_M4_Rotate(M4 *c,float t,int u); +int gl_V3_Norm(V3 *a); + +V3 gl_V3_New(float x,float y,float z); +V4 gl_V4_New(float x,float y,float z,float w); + +int gl_Matrix_Inv(float *r,float *m,int n); + +#endif /*__ZMATH__*/ diff --git a/programs/develop/libraries/TinyGL/src/ztriangle.c b/programs/develop/libraries/TinyGL/src/ztriangle.c new file mode 100644 index 0000000000..366d75c57d --- /dev/null +++ b/programs/develop/libraries/TinyGL/src/ztriangle.c @@ -0,0 +1,394 @@ +#include +#include "zbuffer.h" + +#define ZCMP(z,zpix) ((z) >= (zpix)) + +void ZB_fillTriangleFlat(ZBuffer *zb, + ZBufferPoint *p0,ZBufferPoint *p1,ZBufferPoint *p2) +{ +#if TGL_FEATURE_RENDER_BITS == 24 + unsigned char colorR, colorG, colorB; +#else + int color; +#endif + +#define INTERP_Z + +#if TGL_FEATURE_RENDER_BITS == 24 + +#define DRAW_INIT() \ +{ \ + colorR=p2->r>>8; \ + colorG=p2->g>>8; \ + colorB=p2->b>>8; \ +} + +#define PUT_PIXEL(_a) \ +{ \ + zz=z >> ZB_POINT_Z_FRAC_BITS; \ + if (ZCMP(zz,pz[_a])) { \ + pp[3 * _a]=colorR;\ + pp[3 * _a + 1]=colorG;\ + pp[3 * _a + 2]=colorB;\ + pz[_a]=zz; \ + }\ + z+=dzdx; \ +} + +#else + +#define DRAW_INIT() \ +{ \ + color=RGB_TO_PIXEL(p2->r,p2->g,p2->b); \ +} + +#define PUT_PIXEL(_a) \ +{ \ + zz=z >> ZB_POINT_Z_FRAC_BITS; \ + if (ZCMP(zz,pz[_a])) { \ + pp[_a]=color; \ + pz[_a]=zz; \ + } \ + z+=dzdx; \ +} +#endif /* TGL_FEATURE_RENDER_BITS == 24 */ + +#include "ztriangle.h" +} + +/* + * Smooth filled triangle. + * The code below is very tricky :) + */ + +void ZB_fillTriangleSmooth(ZBuffer *zb, + ZBufferPoint *p0,ZBufferPoint *p1,ZBufferPoint *p2) +{ +#if TGL_FEATURE_RENDER_BITS == 16 + int _drgbdx; +#endif + +#define INTERP_Z +#define INTERP_RGB + +#define SAR_RND_TO_ZERO(v,n) (v / (1<> ZB_POINT_Z_FRAC_BITS; \ + if (ZCMP(zz,pz[_a])) { \ + pp[3 * _a]=or1 >> 8;\ + pp[3 * _a + 1]=og1 >> 8;\ + pp[3 * _a + 2]=ob1 >> 8;\ + pz[_a]=zz; \ + }\ + z+=dzdx; \ + og1+=dgdx; \ + or1+=drdx; \ + ob1+=dbdx; \ +} + +#elif TGL_FEATURE_RENDER_BITS == 16 + +#define DRAW_INIT() \ +{ \ + _drgbdx=(SAR_RND_TO_ZERO(drdx,6) << 22) & 0xFFC00000; \ + _drgbdx|=SAR_RND_TO_ZERO(dgdx,5) & 0x000007FF; \ + _drgbdx|=(SAR_RND_TO_ZERO(dbdx,7) << 12) & 0x001FF000; \ +} + + +#define PUT_PIXEL(_a) \ +{ \ + zz=z >> ZB_POINT_Z_FRAC_BITS; \ + if (ZCMP(zz,pz[_a])) { \ + tmp=rgb & 0xF81F07E0; \ + pp[_a]=tmp | (tmp >> 16); \ + pz[_a]=zz; \ + } \ + z+=dzdx; \ + rgb=(rgb+drgbdx) & ( ~ 0x00200800); \ +} + +#define DRAW_LINE() \ +{ \ + register unsigned short *pz; \ + register PIXEL *pp; \ + register unsigned int tmp,z,zz,rgb,drgbdx; \ + register int n; \ + n=(x2 >> 16) - x1; \ + pp=pp1+x1; \ + pz=pz1+x1; \ + z=z1; \ + rgb=(r1 << 16) & 0xFFC00000; \ + rgb|=(g1 >> 5) & 0x000007FF; \ + rgb|=(b1 << 5) & 0x001FF000; \ + drgbdx=_drgbdx; \ + while (n>=3) { \ + PUT_PIXEL(0); \ + PUT_PIXEL(1); \ + PUT_PIXEL(2); \ + PUT_PIXEL(3); \ + pz+=4; \ + pp+=4; \ + n-=4; \ + } \ + while (n>=0) { \ + PUT_PIXEL(0); \ + pz+=1; \ + pp+=1; \ + n-=1; \ + } \ +} + +#else + +#define DRAW_INIT() \ +{ \ +} + +#define PUT_PIXEL(_a) \ +{ \ + zz=z >> ZB_POINT_Z_FRAC_BITS; \ + if (ZCMP(zz,pz[_a])) { \ + pp[_a] = RGB_TO_PIXEL(or1, og1, ob1);\ + pz[_a]=zz; \ + }\ + z+=dzdx; \ + og1+=dgdx; \ + or1+=drdx; \ + ob1+=dbdx; \ +} + +#endif /* TGL_FEATURE_RENDER_BITS */ + +#include "ztriangle.h" +} + +void ZB_setTexture(ZBuffer *zb,PIXEL *texture) +{ + zb->current_texture=texture; +} + +void ZB_fillTriangleMapping(ZBuffer *zb, + ZBufferPoint *p0,ZBufferPoint *p1,ZBufferPoint *p2) +{ + PIXEL *texture; + +#define INTERP_Z +#define INTERP_ST + +#define DRAW_INIT() \ +{ \ + texture=zb->current_texture; \ +} + +#if TGL_FEATURE_RENDER_BITS == 24 + +#define PUT_PIXEL(_a) \ +{ \ + unsigned char *ptr;\ + zz=z >> ZB_POINT_Z_FRAC_BITS; \ + if (ZCMP(zz,pz[_a])) { \ + ptr = texture + (((t & 0x3FC00000) | s) >> 14) * 3; \ + pp[3 * _a]= ptr[0];\ + pp[3 * _a + 1]= ptr[1];\ + pp[3 * _a + 2]= ptr[2];\ + pz[_a]=zz; \ + } \ + z+=dzdx; \ + s+=dsdx; \ + t+=dtdx; \ +} + +#else + +#define PUT_PIXEL(_a) \ +{ \ + zz=z >> ZB_POINT_Z_FRAC_BITS; \ + if (ZCMP(zz,pz[_a])) { \ + pp[_a]=texture[((t & 0x3FC00000) | s) >> 14]; \ + pz[_a]=zz; \ + } \ + z+=dzdx; \ + s+=dsdx; \ + t+=dtdx; \ +} + +#endif + +#include "ztriangle.h" +} + +/* + * Texture mapping with perspective correction. + * We use the gradient method to make less divisions. + * TODO: pipeline the division + */ +#if 1 + +void ZB_fillTriangleMappingPerspective(ZBuffer *zb, + ZBufferPoint *p0,ZBufferPoint *p1,ZBufferPoint *p2) +{ + PIXEL *texture; + float fdzdx,fndzdx,ndszdx,ndtzdx; + +#define INTERP_Z +#define INTERP_STZ + +#define NB_INTERP 8 + +#define DRAW_INIT() \ +{ \ + texture=zb->current_texture;\ + fdzdx=(float)dzdx;\ + fndzdx=NB_INTERP * fdzdx;\ + ndszdx=NB_INTERP * dszdx;\ + ndtzdx=NB_INTERP * dtzdx;\ +} + + +#if TGL_FEATURE_RENDER_BITS == 24 + +#define PUT_PIXEL(_a) \ +{ \ + unsigned char *ptr;\ + zz=z >> ZB_POINT_Z_FRAC_BITS; \ + if (ZCMP(zz,pz[_a])) { \ + ptr = texture + (((t & 0x3FC00000) | (s & 0x003FC000)) >> 14) * 3;\ + pp[3 * _a]= ptr[0];\ + pp[3 * _a + 1]= ptr[1];\ + pp[3 * _a + 2]= ptr[2];\ + pz[_a]=zz; \ + } \ + z+=dzdx; \ + s+=dsdx; \ + t+=dtdx; \ +} + +#else + +#define PUT_PIXEL(_a) \ +{ \ + zz=z >> ZB_POINT_Z_FRAC_BITS; \ + if (ZCMP(zz,pz[_a])) { \ + pp[_a]=*(PIXEL *)((char *)texture+ \ + (((t & 0x3FC00000) | (s & 0x003FC000)) >> (17 - PSZSH)));\ + pz[_a]=zz; \ + } \ + z+=dzdx; \ + s+=dsdx; \ + t+=dtdx; \ +} + +#endif + +#define DRAW_LINE() \ +{ \ + register unsigned short *pz; \ + register PIXEL *pp; \ + register unsigned int s,t,z,zz; \ + register int n,dsdx,dtdx; \ + float sz,tz,fz,zinv; \ + n=(x2>>16)-x1; \ + fz=(float)z1;\ + zinv=1.0 / fz;\ + pp=(PIXEL *)((char *)pp1 + x1 * PSZB); \ + pz=pz1+x1; \ + z=z1; \ + sz=sz1;\ + tz=tz1;\ + while (n>=(NB_INTERP-1)) { \ + {\ + float ss,tt;\ + ss=(sz * zinv);\ + tt=(tz * zinv);\ + s=(int) ss;\ + t=(int) tt;\ + dsdx= (int)( (dszdx - ss*fdzdx)*zinv );\ + dtdx= (int)( (dtzdx - tt*fdzdx)*zinv );\ + fz+=fndzdx;\ + zinv=1.0 / fz;\ + }\ + PUT_PIXEL(0); \ + PUT_PIXEL(1); \ + PUT_PIXEL(2); \ + PUT_PIXEL(3); \ + PUT_PIXEL(4); \ + PUT_PIXEL(5); \ + PUT_PIXEL(6); \ + PUT_PIXEL(7); \ + pz+=NB_INTERP; \ + pp=(PIXEL *)((char *)pp + NB_INTERP * PSZB);\ + n-=NB_INTERP; \ + sz+=ndszdx;\ + tz+=ndtzdx;\ + } \ + {\ + float ss,tt;\ + ss=(sz * zinv);\ + tt=(tz * zinv);\ + s=(int) ss;\ + t=(int) tt;\ + dsdx= (int)( (dszdx - ss*fdzdx)*zinv );\ + dtdx= (int)( (dtzdx - tt*fdzdx)*zinv );\ + }\ + while (n>=0) { \ + PUT_PIXEL(0); \ + pz+=1; \ + pp=(PIXEL *)((char *)pp + PSZB);\ + n-=1; \ + } \ +} + +#include "ztriangle.h" +} + +#endif + +#if 0 + +/* slow but exact version (only there for reference, incorrect for 24 + bits) */ + +void ZB_fillTriangleMappingPerspective(ZBuffer *zb, + ZBufferPoint *p0,ZBufferPoint *p1,ZBufferPoint *p2) +{ + PIXEL *texture; + +#define INTERP_Z +#define INTERP_STZ + +#define DRAW_INIT() \ +{ \ + texture=zb->current_texture; \ +} + +#define PUT_PIXEL(_a) \ +{ \ + float zinv; \ + int s,t; \ + zz=z >> ZB_POINT_Z_FRAC_BITS; \ + if (ZCMP(zz,pz[_a])) { \ + zinv= 1.0 / (float) z; \ + s= (int) (sz * zinv); \ + t= (int) (tz * zinv); \ + pp[_a]=texture[((t & 0x3FC00000) | s) >> 14]; \ + pz[_a]=zz; \ + } \ + z+=dzdx; \ + sz+=dszdx; \ + tz+=dtzdx; \ +} + +#include "ztriangle.h" +} + + +#endif diff --git a/programs/develop/libraries/TinyGL/src/ztriangle.h b/programs/develop/libraries/TinyGL/src/ztriangle.h new file mode 100644 index 0000000000..b61426420c --- /dev/null +++ b/programs/develop/libraries/TinyGL/src/ztriangle.h @@ -0,0 +1,363 @@ +/* + * We draw a triangle with various interpolations + */ + +{ + ZBufferPoint *t,*pr1,*pr2,*l1,*l2; + float fdx1, fdx2, fdy1, fdy2, fz, d1, d2; + unsigned short *pz1; + PIXEL *pp1; + int part,update_left,update_right; + + int nb_lines,dx1,dy1,tmp,dx2,dy2; + + int error,derror; + int x1,dxdy_min,dxdy_max; +/* warning: x2 is multiplied by 2^16 */ + int x2,dx2dy2; + +#ifdef INTERP_Z + int z1,dzdx,dzdy,dzdl_min,dzdl_max; +#endif +#ifdef INTERP_RGB + int r1,drdx,drdy,drdl_min,drdl_max; + int g1,dgdx,dgdy,dgdl_min,dgdl_max; + int b1,dbdx,dbdy,dbdl_min,dbdl_max; +#endif +#ifdef INTERP_ST + int s1,dsdx,dsdy,dsdl_min,dsdl_max; + int t1,dtdx,dtdy,dtdl_min,dtdl_max; +#endif +#ifdef INTERP_STZ + float sz1,dszdx,dszdy,dszdl_min,dszdl_max; + float tz1,dtzdx,dtzdy,dtzdl_min,dtzdl_max; +#endif + + /* we sort the vertex with increasing y */ + if (p1->y < p0->y) { + t = p0; + p0 = p1; + p1 = t; + } + if (p2->y < p0->y) { + t = p2; + p2 = p1; + p1 = p0; + p0 = t; + } else if (p2->y < p1->y) { + t = p1; + p1 = p2; + p2 = t; + } + + /* we compute dXdx and dXdy for all interpolated values */ + + fdx1 = p1->x - p0->x; + fdy1 = p1->y - p0->y; + + fdx2 = p2->x - p0->x; + fdy2 = p2->y - p0->y; + + fz = fdx1 * fdy2 - fdx2 * fdy1; + if (fz == 0) + return; + fz = 1.0 / fz; + + fdx1 *= fz; + fdy1 *= fz; + fdx2 *= fz; + fdy2 *= fz; + +#ifdef INTERP_Z + d1 = p1->z - p0->z; + d2 = p2->z - p0->z; + dzdx = (int) (fdy2 * d1 - fdy1 * d2); + dzdy = (int) (fdx1 * d2 - fdx2 * d1); +#endif + +#ifdef INTERP_RGB + d1 = p1->r - p0->r; + d2 = p2->r - p0->r; + drdx = (int) (fdy2 * d1 - fdy1 * d2); + drdy = (int) (fdx1 * d2 - fdx2 * d1); + + d1 = p1->g - p0->g; + d2 = p2->g - p0->g; + dgdx = (int) (fdy2 * d1 - fdy1 * d2); + dgdy = (int) (fdx1 * d2 - fdx2 * d1); + + d1 = p1->b - p0->b; + d2 = p2->b - p0->b; + dbdx = (int) (fdy2 * d1 - fdy1 * d2); + dbdy = (int) (fdx1 * d2 - fdx2 * d1); + +#endif + +#ifdef INTERP_ST + d1 = p1->s - p0->s; + d2 = p2->s - p0->s; + dsdx = (int) (fdy2 * d1 - fdy1 * d2); + dsdy = (int) (fdx1 * d2 - fdx2 * d1); + + d1 = p1->t - p0->t; + d2 = p2->t - p0->t; + dtdx = (int) (fdy2 * d1 - fdy1 * d2); + dtdy = (int) (fdx1 * d2 - fdx2 * d1); +#endif + +#ifdef INTERP_STZ + { + float zz; + zz=(float) p0->z; + p0->sz= (float) p0->s * zz; + p0->tz= (float) p0->t * zz; + zz=(float) p1->z; + p1->sz= (float) p1->s * zz; + p1->tz= (float) p1->t * zz; + zz=(float) p2->z; + p2->sz= (float) p2->s * zz; + p2->tz= (float) p2->t * zz; + + d1 = p1->sz - p0->sz; + d2 = p2->sz - p0->sz; + dszdx = (fdy2 * d1 - fdy1 * d2); + dszdy = (fdx1 * d2 - fdx2 * d1); + + d1 = p1->tz - p0->tz; + d2 = p2->tz - p0->tz; + dtzdx = (fdy2 * d1 - fdy1 * d2); + dtzdy = (fdx1 * d2 - fdx2 * d1); + } +#endif + + /* screen coordinates */ + + pp1 = (PIXEL *) ((char *) zb->pbuf + zb->linesize * p0->y); + pz1 = zb->zbuf + p0->y * zb->xsize; + + DRAW_INIT(); + + for(part=0;part<2;part++) { + if (part == 0) { + if (fz > 0) { + update_left=1; + update_right=1; + l1=p0; + l2=p2; + pr1=p0; + pr2=p1; + } else { + update_left=1; + update_right=1; + l1=p0; + l2=p1; + pr1=p0; + pr2=p2; + } + nb_lines = p1->y - p0->y; + } else { + /* second part */ + if (fz > 0) { + update_left=0; + update_right=1; + pr1=p1; + pr2=p2; + } else { + update_left=1; + update_right=0; + l1=p1; + l2=p2; + } + nb_lines = p2->y - p1->y + 1; + } + + /* compute the values for the left edge */ + + if (update_left) { + dy1 = l2->y - l1->y; + dx1 = l2->x - l1->x; + if (dy1 > 0) + tmp = (dx1 << 16) / dy1; + else + tmp = 0; + x1 = l1->x; + error = 0; + derror = tmp & 0x0000ffff; + dxdy_min = tmp >> 16; + dxdy_max = dxdy_min + 1; + +#ifdef INTERP_Z + z1=l1->z; + dzdl_min=(dzdy + dzdx * dxdy_min); + dzdl_max=dzdl_min + dzdx; +#endif +#ifdef INTERP_RGB + r1=l1->r; + drdl_min=(drdy + drdx * dxdy_min); + drdl_max=drdl_min + drdx; + + g1=l1->g; + dgdl_min=(dgdy + dgdx * dxdy_min); + dgdl_max=dgdl_min + dgdx; + + b1=l1->b; + dbdl_min=(dbdy + dbdx * dxdy_min); + dbdl_max=dbdl_min + dbdx; +#endif +#ifdef INTERP_ST + s1=l1->s; + dsdl_min=(dsdy + dsdx * dxdy_min); + dsdl_max=dsdl_min + dsdx; + + t1=l1->t; + dtdl_min=(dtdy + dtdx * dxdy_min); + dtdl_max=dtdl_min + dtdx; +#endif +#ifdef INTERP_STZ + sz1=l1->sz; + dszdl_min=(dszdy + dszdx * dxdy_min); + dszdl_max=dszdl_min + dszdx; + + tz1=l1->tz; + dtzdl_min=(dtzdy + dtzdx * dxdy_min); + dtzdl_max=dtzdl_min + dtzdx; +#endif + } + + /* compute values for the right edge */ + + if (update_right) { + dx2 = (pr2->x - pr1->x); + dy2 = (pr2->y - pr1->y); + if (dy2>0) + dx2dy2 = ( dx2 << 16) / dy2; + else + dx2dy2 = 0; + x2 = pr1->x << 16; + } + + /* we draw all the scan line of the part */ + + while (nb_lines>0) { + nb_lines--; +#ifndef DRAW_LINE + /* generic draw line */ + { + register PIXEL *pp; + register int n; +#ifdef INTERP_Z + register unsigned short *pz; + register unsigned int z,zz; +#endif +#ifdef INTERP_RGB + register unsigned int or1,og1,ob1; +#endif +#ifdef INTERP_ST + register unsigned int s,t; +#endif +#ifdef INTERP_STZ + float sz,tz; +#endif + + n=(x2 >> 16) - x1; + pp=(PIXEL *)((char *)pp1 + x1 * PSZB); +#ifdef INTERP_Z + pz=pz1+x1; + z=z1; +#endif +#ifdef INTERP_RGB + or1 = r1; + og1 = g1; + ob1 = b1; +#endif +#ifdef INTERP_ST + s=s1; + t=t1; +#endif +#ifdef INTERP_STZ + sz=sz1; + tz=tz1; +#endif + while (n>=3) { + PUT_PIXEL(0); + PUT_PIXEL(1); + PUT_PIXEL(2); + PUT_PIXEL(3); +#ifdef INTERP_Z + pz+=4; +#endif + pp=(PIXEL *)((char *)pp + 4 * PSZB); + n-=4; + } + while (n>=0) { + PUT_PIXEL(0); +#ifdef INTERP_Z + pz+=1; +#endif + pp=(PIXEL *)((char *)pp + PSZB); + n-=1; + } + } +#else + DRAW_LINE(); +#endif + + /* left edge */ + error+=derror; + if (error > 0) { + error-=0x10000; + x1+=dxdy_max; +#ifdef INTERP_Z + z1+=dzdl_max; +#endif +#ifdef INTERP_RGB + r1+=drdl_max; + g1+=dgdl_max; + b1+=dbdl_max; +#endif +#ifdef INTERP_ST + s1+=dsdl_max; + t1+=dtdl_max; +#endif +#ifdef INTERP_STZ + sz1+=dszdl_max; + tz1+=dtzdl_max; +#endif + } else { + x1+=dxdy_min; +#ifdef INTERP_Z + z1+=dzdl_min; +#endif +#ifdef INTERP_RGB + r1+=drdl_min; + g1+=dgdl_min; + b1+=dbdl_min; +#endif +#ifdef INTERP_ST + s1+=dsdl_min; + t1+=dtdl_min; +#endif +#ifdef INTERP_STZ + sz1+=dszdl_min; + tz1+=dtzdl_min; +#endif + } + + /* right edge */ + x2+=dx2dy2; + + /* screen coordinates */ + pp1=(PIXEL *)((char *)pp1 + zb->linesize); + pz1+=zb->xsize; + } + } +} + +#undef INTERP_Z +#undef INTERP_RGB +#undef INTERP_ST +#undef INTERP_STZ + +#undef DRAW_INIT +#undef DRAW_LINE +#undef PUT_PIXEL diff --git a/programs/develop/libraries/base64/Tupfile.lua b/programs/develop/libraries/base64/Tupfile.lua new file mode 100644 index 0000000000..847c17f157 --- /dev/null +++ b/programs/develop/libraries/base64/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_GCC") ~= "" then return end +tup.rule("base64.c", "kos32-gcc -fno-ident -Os -c -o %o %f " .. tup.getconfig("KPACK_CMD"), "base64.obj") diff --git a/programs/develop/libraries/box_lib/asm/trunk/Tupfile.lua b/programs/develop/libraries/box_lib/asm/trunk/Tupfile.lua new file mode 100644 index 0000000000..c3718f0dcb --- /dev/null +++ b/programs/develop/libraries/box_lib/asm/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.foreach_rule({"ctrldemo.asm", "editbox_ex.asm"}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "%B") diff --git a/programs/develop/libraries/box_lib/trunk/Tupfile.lua b/programs/develop/libraries/box_lib/trunk/Tupfile.lua new file mode 100644 index 0000000000..0daaf5c167 --- /dev/null +++ b/programs/develop/libraries/box_lib/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("box_lib.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "box_lib.obj") diff --git a/programs/develop/libraries/buf2d/trunk/Tupfile.lua b/programs/develop/libraries/buf2d/trunk/Tupfile.lua new file mode 100644 index 0000000000..c270c40cd3 --- /dev/null +++ b/programs/develop/libraries/buf2d/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("buf2d.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "buf2d.obj") diff --git a/programs/develop/libraries/buf2d/trunk/examples/Tupfile.lua b/programs/develop/libraries/buf2d/trunk/examples/Tupfile.lua new file mode 100644 index 0000000000..b34ba0b9da --- /dev/null +++ b/programs/develop/libraries/buf2d/trunk/examples/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.foreach_rule("*.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "%B") diff --git a/programs/develop/libraries/charset/Tupfile.lua b/programs/develop/libraries/charset/Tupfile.lua new file mode 100644 index 0000000000..6553b2a414 --- /dev/null +++ b/programs/develop/libraries/charset/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("charset.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "charset.obj") diff --git a/programs/develop/libraries/console/Tupfile.lua b/programs/develop/libraries/console/Tupfile.lua new file mode 100644 index 0000000000..41648007d7 --- /dev/null +++ b/programs/develop/libraries/console/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("console.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "console.obj") diff --git a/programs/develop/libraries/console/examples/Tupfile.lua b/programs/develop/libraries/console/examples/Tupfile.lua new file mode 100644 index 0000000000..b34ba0b9da --- /dev/null +++ b/programs/develop/libraries/console/examples/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.foreach_rule("*.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "%B") diff --git a/programs/develop/libraries/crypt_des/example/Tupfile.lua b/programs/develop/libraries/crypt_des/example/Tupfile.lua new file mode 100644 index 0000000000..bb668ba6ef --- /dev/null +++ b/programs/develop/libraries/crypt_des/example/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("crypt_files.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "crypt_files") diff --git a/programs/develop/libraries/crypt_des/trunk/Tupfile.lua b/programs/develop/libraries/crypt_des/trunk/Tupfile.lua new file mode 100644 index 0000000000..3a51231070 --- /dev/null +++ b/programs/develop/libraries/crypt_des/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("crypt_des.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "crypt_des.obj") diff --git a/programs/develop/libraries/exif/examples/Tupfile.lua b/programs/develop/libraries/exif/examples/Tupfile.lua new file mode 100644 index 0000000000..f16d8d6063 --- /dev/null +++ b/programs/develop/libraries/exif/examples/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("viev_exif.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "viev_exif") diff --git a/programs/develop/libraries/exif/trunk/Tupfile.lua b/programs/develop/libraries/exif/trunk/Tupfile.lua new file mode 100644 index 0000000000..b20c5e9c7f --- /dev/null +++ b/programs/develop/libraries/exif/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("exif.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "exif.obj") diff --git a/programs/develop/libraries/fontslib/trunk/Tupfile.lua b/programs/develop/libraries/fontslib/trunk/Tupfile.lua new file mode 100644 index 0000000000..f1ece4fefa --- /dev/null +++ b/programs/develop/libraries/fontslib/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("font_.asm", "fasm %f %o", "font01.ksf") +tup.rule("fonts_lib.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "fonts_lib.obj") diff --git a/programs/develop/libraries/gblib/Tupfile.lua b/programs/develop/libraries/gblib/Tupfile.lua new file mode 100644 index 0000000000..051fbf73bd --- /dev/null +++ b/programs/develop/libraries/gblib/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_GCC") ~= "" then return end +tup.rule("gblib.c", "kos32-gcc -fno-ident -Os -c -o %o %f " .. tup.getconfig("KPACK_CMD"), "gblib.obj") diff --git a/programs/develop/libraries/gblib/example/Tupfile.lua b/programs/develop/libraries/gblib/example/Tupfile.lua new file mode 100644 index 0000000000..f067949271 --- /dev/null +++ b/programs/develop/libraries/gblib/example/Tupfile.lua @@ -0,0 +1,7 @@ +if tup.getconfig("NO_FASM") ~= "" or tup.getconfig("NO_GCC") ~= "" then return end +HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../../.." or tup.getconfig("HELPERDIR") +tup.include(HELPERDIR .. "/use_gcc.lua") +LDFLAGS = LDFLAGS .. " -T kolibri.ld" +tup.append_table(OBJS, tup.rule("asm_code.asm", "fasm %f %o", "asm_code.o")) +compile_gcc{"example.c", "system/kolibri.c", "system/stdlib.c", "system/string.c"} +link_gcc("example") diff --git a/programs/develop/libraries/gblib/example/gblib.h b/programs/develop/libraries/gblib/example/gblib.h index 2b039edab7..bcd3af5422 100644 --- a/programs/develop/libraries/gblib/example/gblib.h +++ b/programs/develop/libraries/gblib/example/gblib.h @@ -1,11 +1,13 @@ +#pragma pack(push, 1) typedef struct { -int w __attribute__((packed)); -int h __attribute__((packed)); -char *bmp __attribute__((packed)); -char *alpha __attribute__((packed)); -} GB_BMP __attribute__((packed)); +int w; +int h; +char *bmp; +char *alpha; +} GB_BMP; +#pragma pack(pop) void (* __stdcall gb_pixel_set)(GB_BMP *b, int x, int y, unsigned c); diff --git a/programs/develop/libraries/gblib/example/kolibri.ld b/programs/develop/libraries/gblib/example/kolibri.ld index 23841f98db..5108410375 100644 --- a/programs/develop/libraries/gblib/example/kolibri.ld +++ b/programs/develop/libraries/gblib/example/kolibri.ld @@ -17,4 +17,8 @@ SECTIONS *(.bss) } Memory = . ; + /DISCARD/ : { + *(.comment) + *(.drectve) + } } diff --git a/programs/develop/libraries/gblib/example/system/kolibri.h b/programs/develop/libraries/gblib/example/system/kolibri.h index 53575d1a72..931f929e09 100644 --- a/programs/develop/libraries/gblib/example/system/kolibri.h +++ b/programs/develop/libraries/gblib/example/system/kolibri.h @@ -1,38 +1,40 @@ #define NULL ((void*)0) +#pragma pack(push, 1) typedef struct { -unsigned p00 __attribute__((packed)); -unsigned p04 __attribute__((packed)); -unsigned p08 __attribute__((packed)); -unsigned p12 __attribute__((packed)); -unsigned p16 __attribute__((packed)); -char p20 __attribute__((packed)); -char *p21 __attribute__((packed)); -} kol_struct70 __attribute__((packed)); +unsigned p00; +unsigned p04; +unsigned p08; +unsigned p12; +unsigned p16; +char p20; +char *p21; +} kol_struct70; typedef struct { -unsigned p00 __attribute__((packed)); -char p04 __attribute__((packed)); -char p05[3] __attribute__((packed)); -unsigned p08 __attribute__((packed)); -unsigned p12 __attribute__((packed)); -unsigned p16 __attribute__((packed)); -unsigned p20 __attribute__((packed)); -unsigned p24 __attribute__((packed)); -unsigned p28 __attribute__((packed)); -unsigned p32[2] __attribute__((packed)); -unsigned p40 __attribute__((packed)); -} kol_struct_BDVK __attribute__((packed)); +unsigned p00; +char p04; +char p05[3]; +unsigned p08; +unsigned p12; +unsigned p16; +unsigned p20; +unsigned p24; +unsigned p28; +unsigned p32[2]; +unsigned p40; +} kol_struct_BDVK; typedef struct { -char *name __attribute__((packed)); -void *data __attribute__((packed)); -} kol_struct_import __attribute__((packed)); +char *name; +void *data; +} kol_struct_import; +#pragma pack(pop) void kol_exit(); diff --git a/programs/develop/libraries/http/Tupfile.lua b/programs/develop/libraries/http/Tupfile.lua new file mode 100644 index 0000000000..182556aabb --- /dev/null +++ b/programs/develop/libraries/http/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("http.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "http.obj") diff --git a/programs/develop/libraries/http/examples/Tupfile.lua b/programs/develop/libraries/http/examples/Tupfile.lua new file mode 100644 index 0000000000..b34ba0b9da --- /dev/null +++ b/programs/develop/libraries/http/examples/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.foreach_rule("*.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "%B") diff --git a/programs/develop/libraries/iconv/Tupfile.lua b/programs/develop/libraries/iconv/Tupfile.lua new file mode 100644 index 0000000000..2fc0b5246e --- /dev/null +++ b/programs/develop/libraries/iconv/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_GCC") ~= "" then return end +tup.rule("iconv.c", "kos32-gcc -fno-ident -Os -c -o %o %f " .. tup.getconfig("KPACK_CMD"), "iconv.obj") diff --git a/programs/develop/libraries/iconv/iconv.c b/programs/develop/libraries/iconv/iconv.c index 647a51990a..98e2ab80c4 100644 --- a/programs/develop/libraries/iconv/iconv.c +++ b/programs/develop/libraries/iconv/iconv.c @@ -1,5 +1,7 @@ -#include -#include +//#include +//#include +typedef unsigned int size_t; +#define NULL ((void*)0) typedef int conv_t; typedef unsigned int ucs4_t; diff --git a/programs/develop/libraries/libcrash/trunk/Tupfile.lua b/programs/develop/libraries/libcrash/trunk/Tupfile.lua new file mode 100644 index 0000000000..7f1895b022 --- /dev/null +++ b/programs/develop/libraries/libcrash/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("libcrash.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "libcrash.obj") +tup.rule("crashtest.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "crashtest") diff --git a/programs/develop/libraries/libs-dev/libgfx/Tupfile.lua b/programs/develop/libraries/libs-dev/libgfx/Tupfile.lua new file mode 100644 index 0000000000..6dc48d28a5 --- /dev/null +++ b/programs/develop/libraries/libs-dev/libgfx/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("libgfx.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "libgfx.obj") diff --git a/programs/develop/libraries/libs-dev/libimg/Tupfile.lua b/programs/develop/libraries/libs-dev/libimg/Tupfile.lua new file mode 100644 index 0000000000..99f85d158e --- /dev/null +++ b/programs/develop/libraries/libs-dev/libimg/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("libimg.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "libimg.obj") diff --git a/programs/develop/libraries/libs-dev/libini/Tupfile.lua b/programs/develop/libraries/libs-dev/libini/Tupfile.lua new file mode 100644 index 0000000000..4a4fe39c15 --- /dev/null +++ b/programs/develop/libraries/libs-dev/libini/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("libini.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "libini.obj") diff --git a/programs/develop/libraries/libs-dev/libio/Tupfile.lua b/programs/develop/libraries/libs-dev/libio/Tupfile.lua new file mode 100644 index 0000000000..35acc86c5c --- /dev/null +++ b/programs/develop/libraries/libs-dev/libio/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("libio.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "libio.obj") diff --git a/programs/develop/libraries/menuetlibc/Makefile b/programs/develop/libraries/menuetlibc/Makefile index 42fb1fc686..0d7578054e 100644 --- a/programs/develop/libraries/menuetlibc/Makefile +++ b/programs/develop/libraries/menuetlibc/Makefile @@ -11,7 +11,6 @@ endif make -C src depend make -C src make -C stub - make -C programs genconfig: ifdef ON_MINGW @@ -24,5 +23,4 @@ clean: make -C src clean make -C linuxtools clean make -C stub clean - make -C programs clean $(RM) mkversion$(EXESUFFIX) diff --git a/programs/develop/libraries/menuetlibc/Tupfile.lua b/programs/develop/libraries/menuetlibc/Tupfile.lua new file mode 100644 index 0000000000..2ec5420f4a --- /dev/null +++ b/programs/develop/libraries/menuetlibc/Tupfile.lua @@ -0,0 +1,6 @@ +if tup.getconfig("TUP_PLATFORM") == "win32" +-- on win32 '#' is not a special character, but backslash and quotes would be printed as is +then tup.rule('echo #define NEEDS_UNDERSCORES > %o', {"config.h"}) +-- on unix '#' should be escaped +else tup.rule('echo "#define NEEDS_UNDERSCORES" > %o', {"config.h"}) +end diff --git a/programs/develop/libraries/menuetlibc/include/libm/math.h b/programs/develop/libraries/menuetlibc/include/libm/math.h index 5156f452e0..7aaae93ab5 100644 --- a/programs/develop/libraries/menuetlibc/include/libm/math.h +++ b/programs/develop/libraries/menuetlibc/include/libm/math.h @@ -167,7 +167,7 @@ extern double j0 __P((double)); extern double j1 __P((double)); extern double jn __P((int, double)); extern double lgamma __P((double)); -extern double nan __P((void)); +extern double nan __P((const char*)); extern double y0 __P((double)); extern double y1 __P((double)); extern double yn __P((int, double)); @@ -187,7 +187,7 @@ extern double nextafter __P((double, double)); extern double pow10 __P((double)); extern double pow2 __P((double)); extern double powi __P((double, int)); -extern void sincos __P((double *, double *, double)); +extern void sincos __P((double, double *, double *)); extern double remainder __P((double, double)); extern double scalb __P((double, double)); @@ -263,7 +263,7 @@ extern float j0f __P((float)); extern float j1f __P((float)); extern float jnf __P((int, float)); extern float lgammaf __P((float)); -extern float nanf __P((void)); +extern float nanf __P((const char*)); extern float y0f __P((float)); extern float y1f __P((float)); extern float ynf __P((int, float)); diff --git a/programs/develop/libraries/menuetlibc/include/math.h b/programs/develop/libraries/menuetlibc/include/math.h index 7fe40ef33e..57d97f541b 100644 --- a/programs/develop/libraries/menuetlibc/include/math.h +++ b/programs/develop/libraries/menuetlibc/include/math.h @@ -74,7 +74,7 @@ long double modfl(long double _x, long double *_pint); double pow10(double _x); double pow2(double _x); double powi(double, int); -void sincos(double *, double *, double); +void sincos(double, double *, double *); /* These are in libm.a (Cygnus). You must link -lm to get these */ /* See libm/math.h for comments */ @@ -100,7 +100,7 @@ extern double j0(double); extern double j1(double); extern double jn(int, double); extern double lgamma(double); -extern double nan(void); +extern double nan(const char*); extern double y0(double); extern double y1(double); extern double yn(int, double); @@ -152,7 +152,7 @@ extern float j0f(float); extern float j1f(float); extern float jnf(int, float); extern float lgammaf(float); -extern float nanf(void); +extern float nanf(const char*); extern float y0f(float); extern float y1f(float); extern float ynf(int, float); diff --git a/programs/develop/libraries/menuetlibc/include/scripts/menuetos_app_v01.ld b/programs/develop/libraries/menuetlibc/include/scripts/menuetos_app_v01.ld index 26004535be..1391b902ca 100644 --- a/programs/develop/libraries/menuetlibc/include/scripts/menuetos_app_v01.ld +++ b/programs/develop/libraries/menuetlibc/include/scripts/menuetos_app_v01.ld @@ -5,6 +5,7 @@ SECTIONS .text 0x000000 : { code = . ; _code = . ; + *(.A) *(.text) *(.fixup) *(.gnu.warning) @@ -43,6 +44,24 @@ SECTIONS { *(.bss) } - end = . ; _end = . ; + end = . ; _end = . ; ___memsize = . ; + /DISCARD/ : + { + *(.debug$S) + *(.debug$T) + *(.debug$F) + *(.drectve) + *(.note.GNU-stack) + *(.eh_frame) + *(.comment) + *(.debug_abbrev) + *(.debug_info) + *(.debug_line) + *(.debug_frame) + *(.debug_loc) + *(.debug_pubnames) + *(.debug_aranges) + *(.debug_ranges) + } } \ No newline at end of file diff --git a/programs/develop/libraries/menuetlibc/include/string.h b/programs/develop/libraries/menuetlibc/include/string.h index b4208a68e2..8dda93ffa2 100644 --- a/programs/develop/libraries/menuetlibc/include/string.h +++ b/programs/develop/libraries/menuetlibc/include/string.h @@ -49,8 +49,8 @@ size_t strxfrm(char *_s1, const char *_s2, size_t _n); #include int bcmp(const void *_ptr1, const void *_ptr2, int _length); -void * bcopy(const void *_a, void *_b, size_t _len); -void * bzero(void *ptr, size_t _len); +void bcopy(const void *_a, void *_b, size_t _len); +void bzero(void *ptr, size_t _len); int ffs(int _mask); char * index(const char *_string, int _c); void * memccpy(void *_to, const void *_from, int c, size_t n); diff --git a/programs/develop/libraries/menuetlibc/programs/Makefile b/programs/develop/libraries/menuetlibc/programs/Makefile deleted file mode 100644 index 88563310a1..0000000000 --- a/programs/develop/libraries/menuetlibc/programs/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -all: - make -C binclock - -clean: - make -C binclock clean diff --git a/programs/develop/libraries/menuetlibc/programs/contemp/Makefile b/programs/develop/libraries/menuetlibc/programs/contemp/Makefile deleted file mode 100644 index 0b486fe9f9..0000000000 --- a/programs/develop/libraries/menuetlibc/programs/contemp/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -OUTFILE = xapp -OBJS = main.o -LIBS = -lcon2 - -include $(MENUETDEV)/makefiles/Makefile_for_program diff --git a/programs/develop/libraries/menuetlibc/programs/contemp/main.c b/programs/develop/libraries/menuetlibc/programs/contemp/main.c deleted file mode 100644 index f7425d96db..0000000000 --- a/programs/develop/libraries/menuetlibc/programs/contemp/main.c +++ /dev/null @@ -1,110 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -static int did_con_init=0; - -static char * WindowTitle="xtest"; - -static char con_buffer[0x100000]; -static char * conp=con_buffer+0; -static unsigned long sz=0; - -void check_board(void) -{ - int d0,d1; - do { - __asm__ __volatile__("int $0x40":"=a"(d0),"=b"(d1):"0"(63),"1"(2)); - if(d1!=1) break; - _lcon_putch(d0&0xff); - *conp++=(d0&0xff); - sz++; - } while(1); -} - -void paint_wnd(void) -{ - __menuet__window_redraw(1); - __menuet__define_window(100,100,20+(NR_CHARS_X*CHAR_SIZE_X), - 30+(NR_CHARS_Y*CHAR_SIZE_Y),0x03000080,0x800000FF,0x000080); - __menuet__write_text(5,5,0xFFFFFF,WindowTitle,strlen(WindowTitle)); - if(did_con_init) _lcon_flush_console(); - __menuet__window_redraw(2); -} - -static char kpf_buf[1024]; - -void _kph_pf(char * p) -{ - for(;p && *p;p++) _lcon_putch(*p); -} - -void kprintf(const char * fmt,...) -{ - va_list ap; - va_start(ap,fmt); - vsprintf(kpf_buf,fmt,ap); - va_end(ap); - _kph_pf(kpf_buf); -} - -int event_loop(void) -{ - int i; - i=__menuet__check_for_event(); - switch(i) - { - case 1: - paint_wnd(); return 0; - case 2: - return __menuet__getkey(); - case 3: - if(__menuet__get_button_id()==1) - { - exit(0); - } - return 0; - } - return 1; -} - -void main(void) -{ - unsigned long xtmp; - int a,b,c; - FILE * f=fopen("example","rb"); - did_con_init=0; - paint_wnd(); - init_consoles(); - did_con_init=1; - xtmp=__menuet__getsystemclock(); - a=(xtmp>>16)&0xff; - b=(xtmp>>8)&0xff; - c=xtmp&0xff; - kprintf("h/m/s=%x:%x:%x %u:%u:%u\n",a,b,c,a,b,c); -#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10) - BCD_TO_BIN(a); - BCD_TO_BIN(b); - BCD_TO_BIN(c); - kprintf("h/m/s=%x:%x:%x %u:%u:%u\n",a,b,c,a,b,c); - __asm__ __volatile__("int $0x40":"=a"(xtmp):"0"(29)); - a=(xtmp>>16)&0xff; - b=(xtmp>>8)&0xff; - c=xtmp&0xff; - kprintf("y/d/m=%x:%x:%x %u:%u:%u\n",a,b,c,a,b,c); -#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10) - BCD_TO_BIN(a); - BCD_TO_BIN(b); - BCD_TO_BIN(c); - kprintf("y/d/m=%x:%x:%x %u:%u:%u\n",a,b,c,a,b,c); - for(;;) - { - check_board(); - event_loop(); - } -} diff --git a/programs/develop/libraries/menuetlibc/programs/htmlview/Makefile b/programs/develop/libraries/menuetlibc/programs/htmlview/Makefile deleted file mode 100644 index e730aea662..0000000000 --- a/programs/develop/libraries/menuetlibc/programs/htmlview/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -OUTFILE = htmlview -OBJS = parser.o filestreamparser.o textstreamparser.o HTML.o -CFLAGS = -I. - -include $(MENUETDEV)/makefiles/Makefile_for_cpp_program diff --git a/programs/develop/libraries/menuetlibc/programs/htmlview/copying b/programs/develop/libraries/menuetlibc/programs/htmlview/copying deleted file mode 100644 index d60c31a97a..0000000000 --- a/programs/develop/libraries/menuetlibc/programs/htmlview/copying +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/programs/develop/libraries/menuetlibc/programs/htmlview/filestreamparser.cpp b/programs/develop/libraries/menuetlibc/programs/htmlview/filestreamparser.cpp deleted file mode 100644 index 7311f0533b..0000000000 --- a/programs/develop/libraries/menuetlibc/programs/htmlview/filestreamparser.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - Parser class for FILE stream derived from CParser class. - Copyright (C) 2003 Jarek Pelczar (jarekp3@wp.pl) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include"parser.h" -#include - -CFileStreamParser::CFileStreamParser(FILE * ff):CParser() -{ - f=ff; -} - -CFileStreamParser::~CFileStreamParser() -{ - this->CParser::~CParser(); -} - -char CFileStreamParser::GetChar() -{ - int c; - if(IsEOF) return 0; - c=fgetc(f); - if(c<0) - { - IsEOF=true; - return 0; - } - Look=c; - return c; -} diff --git a/programs/develop/libraries/menuetlibc/programs/htmlview/html.cpp b/programs/develop/libraries/menuetlibc/programs/htmlview/html.cpp deleted file mode 100644 index 77065df079..0000000000 --- a/programs/develop/libraries/menuetlibc/programs/htmlview/html.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - Main HTML parser code. - Copyright (C) 2003 Jarek Pelczar (jarekp3@wp.pl) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include"parser.h" -#include -#include"HTML.h" - -CHTMLParser::CHTMLParser(CParser * par,CPageBuffer * buf) -{ - parser=par; - pgbuf=buf; - DefaultStyles(); - parser->Init(); -} - -CHTMLParser::~CHTMLParser() -{ - delete parser; -} - -void CHTMLParser::DefaultStyles() -{ - text_style.flags=FFLAG_ALIGNLEFT; - text_style.FontName="system"; - text_style.FontSize=8; - text_style.color=0; - text_style.next=NULL; - page_style.background=0xffffffff; - page_style.text=0; - page_style.link=0x008000; - page_style.alink=0x000080; - page_style.vlink=0x800000; - page_style.flags=PFLAG_ALIGNLEFT|PFLAG_RAWMODE; - pgbuf->Reset(); -} - -void CHTMLParser::Parse() -{ - char * tokenbuf; - tokenbuf=new char[1024]; - while(!parser->isEOF()) - { - parser->SkipWhite(); - if(parser->Look=='<') - { - parser->Match('<'); - memset(tokenbuf,0,1024); - parser->GetToken(tokenbuf,1020); - parser->Match('>'); - } - } - delete tokenbuf; -} diff --git a/programs/develop/libraries/menuetlibc/programs/htmlview/html.h b/programs/develop/libraries/menuetlibc/programs/htmlview/html.h deleted file mode 100644 index 93c4f87615..0000000000 --- a/programs/develop/libraries/menuetlibc/programs/htmlview/html.h +++ /dev/null @@ -1,128 +0,0 @@ -#ifndef __HTML_h -#define __HTML_h - -#include"parser.h" - -template class CHTMLStack -{ -public: - CHTMLStack() - { - FirstItem=NULL; - NR=0; - } - void Push(T * ff) - { - T * ff1; - if(!ff) return; - ff1=(T *)malloc(sizeof(T)); - memcpy((void *)ff1,(const void *)ff,sizeof(T)); - NR++; - ff1->next=FirstElem; - FirstElem=ff1; - } - T * Pop() - { - T * R; - if(!NR) return NULL; - NR--; - R=FirstElem; - FirstElem=R->next; - return R; - } - void Free(T * x) - { - free(x); - } - ~CHTMLStack() - { - T * __tmp; - while((__tmp=Pop())) this->Free(__tmp); - } -protected: - T * FirstElem; - int NR; -}; - -struct text_style { - unsigned long flags; - char * FontName; - int FontSize; - unsigned long color; - struct text_style * next; -}; - -struct page_style { - unsigned long background; - unsigned long text; - unsigned long link,alink,vlink; - unsigned long flags; - struct page_style * next; -}; - -struct image_properties { - int width,height; - int border; -}; - -struct text_properties { - char * FontName; - int font_size; - int color; - unsigned long flags; -}; - -struct cpb_Text { - struct text_properties prop; - char * Text; - int len; -}; - -struct cpb_Image { - struct image_properties img; - void * ImageData; -}; - -class CPageBuffer -{ -public: - CPageBuffer(); - ~CPageBuffer(); - virtual void AddText(char *,int,struct text_properties *); - virtual void AddImage(char *,struct image_properties *); - virtual void Paint(); - virtual void Reset(); -private: - int nr_text,nr_images; - struct cpb_Text ** _text; - struct cpb_Image ** _images; -}; - -class CHTMLParser -{ -public: - CHTMLParser(CParser * par,CPageBuffer * buf); - ~CHTMLParser(); - virtual void DefaultStyles(); - virtual void Parse(); - virtual void ParseHTML(); -protected: - CParser * parser; - CPageBuffer * pgbuf; - struct text_style text_style; - struct page_style page_style; -}; - -#define FFLAG_ALIGNLEFT 0x00000001 -#define FFLAG_ALIGNRIGHT 0x00000002 -#define FFLAG_ALIGNCENTER 0x00000003 -#define FFLAG_BOLD 0x00000004 -#define FFLAG_ITALIC 0x00000008 -#define FFLAG_UNDERLINE 0x00000010 - -#define PFLAG_ALIGNLEFT 0x00000001 -#define PFLAG_ALIGNRIGHT 0x00000002 -#define PFLAG_ALIGNCENTER 0x00000003 -#define PFLAG_RAWMODE 0x00000004 - -#endif diff --git a/programs/develop/libraries/menuetlibc/programs/htmlview/pagebuffer.cpp b/programs/develop/libraries/menuetlibc/programs/htmlview/pagebuffer.cpp deleted file mode 100644 index 94f78fba8e..0000000000 --- a/programs/develop/libraries/menuetlibc/programs/htmlview/pagebuffer.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include -#include -#include -#include"HTML.h" - diff --git a/programs/develop/libraries/menuetlibc/programs/htmlview/parser.cpp b/programs/develop/libraries/menuetlibc/programs/htmlview/parser.cpp deleted file mode 100644 index 05029903da..0000000000 --- a/programs/develop/libraries/menuetlibc/programs/htmlview/parser.cpp +++ /dev/null @@ -1,165 +0,0 @@ -/* - Generic parser class for HTML viewer. - Copyright (C) 2003 Jarek Pelczar (jarekp3@wp.pl) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include"parser.h" -#include - -CParser::CParser() -{ - IsEOF=false; - Look=0; -} - -CParser::~CParser() -{ -} - -char CParser::GetChar() -{ - return 0; -} - -void CParser::Init() -{ - GetChar(); -} - -void CParser::SkipWhite() -{ - if(IsEOF) return; - while(Look==' ' || Look=='\t' || Look=='\n' || Look=='\r') - GetChar(); -} - -int CParser::Match(char c) -{ - if(IsEOF) return 0; - SkipWhite(); - if(Look==c) return 1; - return 0; -} - -static inline int hex2dec(char c) -{ - if(c>='0'&&c<='9') return c-'0'; - if(c>='a'&&c<='f') return c-'a'+10; - if(c>='A'&&c<='F') return c-'A'+10; - return 0; -} - -unsigned long CParser::__GetNum() -{ - unsigned long __ret=0; - SkipWhite(); - while(isdigit(Look)) - { - __ret=(__ret*10)+(Look-'0'); - GetChar(); - } - return __ret; -} - -unsigned long CParser::__GetHexNum() -{ - unsigned long __ret=0; - SkipWhite(); - while(isxdigit(Look)) - { - __ret=(__ret<<4)+hex2dec(Look); - GetChar(); - } - return __ret; -} - -unsigned long CParser::__GetOctNum() -{ - unsigned long __ret=0; - SkipWhite(); - while(Look>='0' && Look<='7') - { - __ret=(__ret<<3)+(Look-'0'); - GetChar(); - } - return __ret; -} - -/* This routine simply calls previously defined functions. - So the number may be (of course in HTML) : - number example class - #1BADB002 hex - #0x1BADB002 hex - $0x1BADB002 hex - 0xF002 hex - 03312 octal - 32768 decimal - Note: - We don't have to remember leading zeroes because they always give 0 - so there isn't anything to complain about. -*/ -unsigned long CParser::GetNum() -{ - if(Look=='#') - { - Match('#'); - if(Look=='0') - { - GetChar(); - if(Look=='x') - { - GetChar(); - return __GetHexNum(); - } - } - return __GetHexNum(); - } - if(Look=='$') - { - Match('$'); - return __GetHexNum(); - } - if(Look=='0') - { - GetChar(); - if(Look=='x') - { - GetChar(); - return __GetHexNum(); - } - return __GetOctNum(); - } - return __GetNum(); -} - -int CParser::GetToken(char * tokbuf,int maxlen) -{ - int p; - if(!tokbuf || !maxlen) return 0; - if(IsEOF) return 0; - SkipWhite(); - if(!isalpha(Look) && Look!='_') return 0; - p=0; - while(maxlen-- && (isalpha(Look) || isdigit(Look) || Look=='_')) - { - *tokbuf++=Look; - GetChar(); - p++; - } - return p; -} diff --git a/programs/develop/libraries/menuetlibc/programs/htmlview/parser.h b/programs/develop/libraries/menuetlibc/programs/htmlview/parser.h deleted file mode 100644 index 70a207f39c..0000000000 --- a/programs/develop/libraries/menuetlibc/programs/htmlview/parser.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef __PARSER_H -#define __PARSER_H - -class CFileStreamParser; -class CTextStreamParser; - -class CParser -{ -friend class CFileStreamParser; -friend class CTextStreamParser; -public: - CParser(); - ~CParser(); - virtual char GetChar(); - void Init(); - void SkipWhite(); - int Match(char c); - unsigned long GetNum(); - int GetToken(char * tokbuf,int maxlen); - inline bool isEOF() { return IsEOF; } - char Look; -private: - bool IsEOF; - unsigned long __GetNum(); - unsigned long __GetHexNum(); - unsigned long __GetOctNum(); -}; - -class CFileStreamParser: public CParser -{ -public: - CFileStreamParser(FILE *); - ~CFileStreamParser(); - virtual char GetChar(); -private: - FILE * f; -}; - -class CTextStreamParser: public CParser -{ -public: - CTextStreamParser(char * Stm,int stm_size); - ~CTextStreamParser(); - virtual char GetChar(); -private: - char * __Stm; - int __Size; - int __Pos; -}; - -#endif diff --git a/programs/develop/libraries/menuetlibc/programs/htmlview/textstreamparser.cpp b/programs/develop/libraries/menuetlibc/programs/htmlview/textstreamparser.cpp deleted file mode 100644 index b70de45adc..0000000000 --- a/programs/develop/libraries/menuetlibc/programs/htmlview/textstreamparser.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - Parser class for memory stream derived from CParser class. - Copyright (C) 2003 Jarek Pelczar (jarekp3@wp.pl) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include -#include"parser.h" -#include - -CTextStreamParser::CTextStreamParser(char * Stm,int stm_size):CParser() -{ - __Stm=Stm; - __Size=stm_size; - __Pos=0; -} - -CTextStreamParser::~CTextStreamParser() -{ - this->CParser::~CParser(); -} - -char CTextStreamParser::GetChar() -{ - unsigned char c; - if(IsEOF) return 0; - if(__Pos>=__Size) - { - IsEOF=true; - return 0; - } - c=*(unsigned char *)(__Stm+__Pos); - __Pos++; - Look=c; - return c; -} diff --git a/programs/develop/libraries/menuetlibc/programs/ld-dll.old/Makefile b/programs/develop/libraries/menuetlibc/programs/ld-dll.old/Makefile deleted file mode 100644 index 01c937a82e..0000000000 --- a/programs/develop/libraries/menuetlibc/programs/ld-dll.old/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -OUTFILE = ld-dll -OBJS = kernel.o dll_list.o main.o -LIBS = -lmcoff -Map ld-dll.map -CFLAGS = -fwritable-strings -fno-merge-constants - -include $(MENUETDEV)/makefiles/Makefile_for_program diff --git a/programs/develop/libraries/menuetlibc/programs/ld-dll.old/dll_list.c b/programs/develop/libraries/menuetlibc/programs/ld-dll.old/dll_list.c deleted file mode 100644 index e8687781da..0000000000 --- a/programs/develop/libraries/menuetlibc/programs/ld-dll.old/dll_list.c +++ /dev/null @@ -1,103 +0,0 @@ -#include"loader.h" - -#define MAX_DLL 32 - -static dll_t dll_list[MAX_DLL]; - -SYMENT * dl_find_dll_symbol(char * name,dll_t ** xdll) -{ - dll_t * dll; - SYMENT * __ret; - int i; - for(dll=dll_list+0,i=0;iobj) - { - __ret=find_coff_symbol(dll->obj,name); - if(__ret) - { - *xdll=dll; - return __ret; - } - } - } - *xdll=(dll_t *)NULL; - return 0; -} - -unsigned long dl_get_ref(char * symname) -{ - dll_t * dll; - SYMENT * sym=dl_find_dll_symbol(symname,&dll); - if(!sym && !dll) return 0; - return sym->e_value+dll->obj->co_sections[sym->e_scnum-1].s_scnptr+dll->obj->co_loadaddr; -} - -void init_dll(void) -{ - int i; - for(i=0;iobj) - { - p->obj=mcoff_load_file(name); - if(!p->obj) return NULL; - return p; - } - } - return NULL; -} - -int dll_symlookupfn(coffobj_t * obj,unsigned long * sym_val, - unsigned long * sym_sect,int index) -{ - SYMENT * symtab; - unsigned long lookup; - char xname[9]; - char * symnamep; - symtab=obj->co_symtab+index; - *sym_sect=(unsigned long)symtab->e_scnum; - if(symtab->e_scnum>0) - { - *sym_val=symtab->e_value; - return 0; - } - if(symtab->e.e.e_zeroes==0) - { - symnamep=(char *)(((long)obj->co_strtab)+symtab->e.e.e_offset); - } else { - symnamep=(char *)symtab->e.e_name; - memset(xname,0,9); - memcpy(xname,symnamep,8); - symnamep=xname; - } - lookup=kexport_lookup(symnamep); - if(lookup) - { - *sym_val=lookup; - return 0; - } - lookup=dl_get_ref(symnamep); - if(!lookup) return -1; - *sym_val=lookup; - return 0; -} - -int relocate_dlls(void) -{ - int i; - dll_t * dll; - for(i=0,dll=dll_list+0;iobj) - if(relocate_coff_file(dll->obj,dll_symlookupfn)) return -1; - return 0; -} diff --git a/programs/develop/libraries/menuetlibc/programs/ld-dll.old/kernel.c b/programs/develop/libraries/menuetlibc/programs/ld-dll.old/kernel.c deleted file mode 100644 index fb7bb56b78..0000000000 --- a/programs/develop/libraries/menuetlibc/programs/ld-dll.old/kernel.c +++ /dev/null @@ -1,36 +0,0 @@ -#include"loader.h" - -#define EX(x) \ - { "_"#x , (unsigned long)&x } - -extern void * sbrk(int); -extern void _exit(int); - -static struct { - char * name; - unsigned long ptr; -} kextable[]={ - EX(sbrk), - EX(errno), - EX(malloc), - EX(free), - EX(realloc), - EX(atexit), - EX(exit), - EX(getenv), - EX(_exit), -}; - -#define NR_KEX (sizeof(kextable)/sizeof(kextable[0])) - -unsigned long kexport_lookup(char * name) -{ - int i,j; - j=strlen(name); - for(i=0;i -#include -#include -#include -#include - -unsigned long kexport_lookup(char * name); - -typedef struct { - coffobj_t * obj; - void (* entry_point)(void); -} dll_t; - -SYMENT * dl_find_dll_symbol(char * name,dll_t ** xdll); -unsigned long dl_get_ref(char * symname); -void init_dll(void); -dll_t * load_dll(char * name); -int relocate_dlls(void); - -#endif diff --git a/programs/develop/libraries/menuetlibc/programs/ld-dll.old/main.c b/programs/develop/libraries/menuetlibc/programs/ld-dll.old/main.c deleted file mode 100644 index 026ae574e5..0000000000 --- a/programs/develop/libraries/menuetlibc/programs/ld-dll.old/main.c +++ /dev/null @@ -1,87 +0,0 @@ -#include"loader.h" - -extern char __menuet__app_param_area[]; - -static char program_name[1024]; -static char * argp; - -static void extract_base_program_name(void) -{ - char * p; - int i; - p=strchr(__menuet__app_param_area,' '); - if(!p) - { - i=strlen(__menuet__app_param_area); - } else { - i=((long)p)-((long)__menuet__app_param_area); - if(!i) - { - __libclog_printf("No program name supplied\n"); - exit(-1); - } - } - memcpy(program_name,__menuet__app_param_area,i); - program_name[i]='\0'; - argp=&program_name[i+1]; -} - -dll_t * main_program,*dll; -char ** dll_load_table; - -static char tmp[1024]; - -dll_t * try_load_dll(char * dllname) -{ - if(dllname[0]=='/') return load_dll(dllname); - sprintf(tmp,"/RD/1/%s",dllname); - if(!(dll=load_dll(tmp))) return; - sprintf(tmp,"/HD/1/MENUETOS/%s",dllname); - if(!(dll=load_dll(tmp))) return; - sprintf(tmp,"/HD/1/MENUETOS/DLL/%s",dllname); - if(!(dll=load_dll(tmp))) return; - return load_dll(dllname); -} - -int (* xmain)(void); - -void main(void) -{ - __libclog_printf("Supplied parameters:\n"); - __libclog_printf("|%s|\n",__menuet__app_param_area); - extract_base_program_name(); - init_dll(); - main_program=load_dll(program_name); - if(!main_program) - { - __libclog_printf("Unable to open main program\n"); - exit(-1); - } - dll_load_table=(char **)mcoff_get_ref(main_program->obj,"__required_dll"); - if(dll_load_table) - { - int i; - for(i=0;dll_load_table[i];i++) - { - if(!(dll=try_load_dll(dll_load_table[i]))) - { - __libclog_printf("Unable to load dll '%s'\n",dll_load_table[i]); - exit(-1); - } - xmain=(void *)mcoff_get_ref(dll->obj,"_DllMain"); - if(xmain) xmain(); - } - } - if(relocate_dlls()!=0) - { - __libclog_printf("Unable to relocate dynamic objects\n"); - exit(-1); - } - xmain=(void *)mcoff_get_ref(main_program->obj,"_app_main"); - if(!xmain) - { - __libclog_printf("Unable to find _app_main symbol in main program"); - exit(-1); - } - exit(xmain()); -} diff --git a/programs/develop/libraries/menuetlibc/programs/ld-dll/Makefile b/programs/develop/libraries/menuetlibc/programs/ld-dll/Makefile deleted file mode 100644 index dd0bb1b31b..0000000000 --- a/programs/develop/libraries/menuetlibc/programs/ld-dll/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -OUTFILE = ld-dll -OBJS = kernel.o dll_list.o -CFLAGS = -O2 -fomit-frame-pointer -LIBS = -lmcoff - -include $(MENUETDEV)/makefiles/Makefile_for_program diff --git a/programs/develop/libraries/menuetlibc/programs/ld-dll/dll_desc.h b/programs/develop/libraries/menuetlibc/programs/ld-dll/dll_desc.h deleted file mode 100644 index 9e7806ca81..0000000000 --- a/programs/develop/libraries/menuetlibc/programs/ld-dll/dll_desc.h +++ /dev/null @@ -1,9 +0,0 @@ -typedef struct { - char dll_name[1]; -} dll_req_entry_t; - -typedef struct { - dll_req_entry_t req_list[0]; -} dll_req_t; - -#define DLL_REQ_LIST_NAME "__DLL_REQUIRE_LIST__" diff --git a/programs/develop/libraries/menuetlibc/programs/ld-dll/dll_list.c b/programs/develop/libraries/menuetlibc/programs/ld-dll/dll_list.c deleted file mode 100644 index bbd4e90977..0000000000 --- a/programs/develop/libraries/menuetlibc/programs/ld-dll/dll_list.c +++ /dev/null @@ -1,119 +0,0 @@ -#include"ld-dll.h" - -#define MAX_DLL 32 - -static dll_t dll_list[MAX_DLL]; - -SYMENT * dl_find_dll_symbol(char * name,dll_t ** xdll) -{ - dll_t * dll; - SYMENT * __ret; - int i; - for(dll=dll_list+0,i=0;iobj) - { - __ret=find_coff_symbol(dll->obj,name); - if(__ret) - { - *xdll=dll; - return __ret; - } - } - } - *xdll=(dll_t *)NULL; - return 0; -} - -unsigned long dl_get_ref(char * symname) -{ - dll_t * dll; - SYMENT * sym=dl_find_dll_symbol(symname,&dll); - if(!sym && !dll) return 0; - return sym->e_value+dll->obj->co_sections[sym->e_scnum-1].s_scnptr+dll->obj->co_loadaddr; -} - -void init_dll(void) -{ - int i; - for(i=0;iobj) - { - p->obj=mcoff_load_file(name); - p->d_name=strdup(name); - if(!p->obj) return NULL; - return p; - } - } - return NULL; -} - -dll_t * find_dll(char * name) -{ - dll_t * p; - int i,j=strlen(name); - for(i=0,p=dll_list+0;iobj) - { - if(strlen(p->d_name)==j && - !strncmp(name,p->d_name,j)) return p; - } - } - return NULL; -} - -int dll_symlookupfn(coffobj_t * obj,unsigned long * sym_val, - unsigned long * sym_sect,int index) -{ - SYMENT * symtab; - unsigned long lookup; - char xname[9]; - char * symnamep; - symtab=obj->co_symtab+index; - *sym_sect=(unsigned long)symtab->e_scnum; - if(symtab->e_scnum>0) - { - *sym_val=symtab->e_value; - return 0; - } - if(symtab->e.e.e_zeroes==0) - { - symnamep=(char *)(((long)obj->co_strtab)+symtab->e.e.e_offset); - } else { - symnamep=(char *)symtab->e.e_name; - memset(xname,0,9); - memcpy(xname,symnamep,8); - symnamep=xname; - } - lookup=kexport_lookup(symnamep); - if(lookup) - { - *sym_val=lookup; - return 0; - } - lookup=dl_get_ref(symnamep); - if(!lookup) return -1; - *sym_val=lookup; - return 0; -} - -int relocate_dlls(void) -{ - int i; - dll_t * dll; - for(i=0,dll=dll_list+0;iobj) - if(relocate_coff_file(dll->obj,dll_symlookupfn)) return -1; - return 0; -} diff --git a/programs/develop/libraries/menuetlibc/programs/ld-dll/kernel.c b/programs/develop/libraries/menuetlibc/programs/ld-dll/kernel.c deleted file mode 100644 index f2f2b109d5..0000000000 --- a/programs/develop/libraries/menuetlibc/programs/ld-dll/kernel.c +++ /dev/null @@ -1,37 +0,0 @@ -#include"ld-dll.h" - -#define EX(x) \ - { "_"#x , (unsigned long)&x } - -extern void * sbrk(int); - -extern void _exit(int); - -static struct { - char * name; - unsigned long ptr; -} kextable[]={ - EX(sbrk), - EX(errno), - EX(malloc), - EX(free), - EX(realloc), - EX(atexit), - EX(exit), - EX(getenv), - EX(_exit), -}; - -#define NR_KEX (sizeof(kextable)/sizeof(kextable[0])) - -unsigned long kexport_lookup(char * name) -{ - int i,j; - j=strlen(name); - for(i=0;i -#include -#include -#include -#include - -unsigned long kexport_lookup(char * name); - -typedef struct { - coffobj_t * obj; - void (* entry_point)(void); - char * d_name; -} dll_t; - -SYMENT * dl_find_dll_symbol(char * name,dll_t ** xdll); -unsigned long dl_get_ref(char * symname); -void init_dll(void); -dll_t * load_dll(char * name); -int relocate_dlls(void); -dll_t * find_dll(char * name); - -#endif diff --git a/programs/develop/libraries/menuetlibc/programs/ld-dll/main.c b/programs/develop/libraries/menuetlibc/programs/ld-dll/main.c deleted file mode 100644 index d878ec26f8..0000000000 --- a/programs/develop/libraries/menuetlibc/programs/ld-dll/main.c +++ /dev/null @@ -1,54 +0,0 @@ -#include"ld-dll.h" -#include"dll_desc.h" - -dll_t * main_program; - -static char * std_dll_paths[]={ - "/rd/1/", - "/hd/1/menuetos/", - "/hd/1/menuetos/dll/", - "./", - NULL -}; - -static char dll_name_buf[1024]; - -dll_t * do_load_dll( -void main(void) -{ - init_dll(); - main_program=load_dll("/rd/1/test.app"); - if(!main_program) - { - dprintf("Main load failed\n"); - exit(-1); - } - { dll_t * tmp; - if(!(tmp=load_dll("/rd/1/vcrt.dll"))) - { - dprintf("Unable to load vcrt.dll\n"); - exit(-1); - } - dprintf("Looking for entry point\n"); - tmp->entry_point=(void *)mcoff_get_ref(tmp->obj,"_DllMain"); - if(tmp->entry_point) tmp->entry_point(); - if(!(tmp=load_dll("MOSKRNL.SO"))) - if(!(tmp=load_dll("/RD/1/MOSKRNL.SO"))) - if(!(tmp=load_dll("/HD/1/MENUETOS/MOSKRNL.SO"))) - { - dprintf("Unable to load moskrnl.so\n"); - exit(-1); - } - tmp->entry_point=(void *)mcoff_get_ref(tmp->obj,"_DllMain"); - if(tmp->entry_point) tmp->entry_point(); - } - relocate_dlls(); - main_program->entry_point=(void *)mcoff_get_ref(main_program->obj,"_main"); - if(!main_program->entry_point) - { - dprintf("Failed to find main program entry point\n"); - exit(-1); - } - main_program->entry_point(); - exit(0); -} diff --git a/programs/develop/libraries/menuetlibc/programs/multiview/Makefile b/programs/develop/libraries/menuetlibc/programs/multiview/Makefile deleted file mode 100644 index fb905f11da..0000000000 --- a/programs/develop/libraries/menuetlibc/programs/multiview/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -OUTFILE = mview -OBJS = main.o -LIBS = -lmgfx -ljpeg - -include $(MENUETDEV)/makefiles/Makefile_for_program diff --git a/programs/develop/libraries/menuetlibc/programs/multiview/main.c b/programs/develop/libraries/menuetlibc/programs/multiview/main.c deleted file mode 100644 index 5a4094b4e8..0000000000 --- a/programs/develop/libraries/menuetlibc/programs/multiview/main.c +++ /dev/null @@ -1,45 +0,0 @@ -#include -#include -#include -#include -#include -#include"libmgfx.h" - -static char * Title="MenuetMultiview"; - -mgfx_image_t * img; - -void paint(void) -{ - __menuet__window_redraw(1); - __menuet__define_window(100,100,400,300,0x03000080,0x800000FF,0x000080); - __menuet__write_text(3,3,0xFFFFFF,Title,strlen(Title)); - if(img) - paint_image(10,30,img); - __menuet__window_redraw(2); -} - -int event_loop(void) -{ - int i; - i=__menuet__wait_for_event(); - switch(i) - { - case 1: - paint(); return 0; - case 2: - return __menuet__getkey(); - case 3: - if(__menuet__get_button_id()==1) exit(0); return 0; - } -} - -void main(void) -{ - img=NULL; - init_mgfx_library(); - paint(); - load_image("/rd/1/test.jpg",&img); - paint_image(10,30,img); - for(;;) event_loop(); -} diff --git a/programs/develop/libraries/menuetlibc/programs/multiview/test.jpg b/programs/develop/libraries/menuetlibc/programs/multiview/test.jpg deleted file mode 100644 index de224d9fc4..0000000000 Binary files a/programs/develop/libraries/menuetlibc/programs/multiview/test.jpg and /dev/null differ diff --git a/programs/develop/libraries/menuetlibc/programs/plaympg/Makefile b/programs/develop/libraries/menuetlibc/programs/plaympg/Makefile deleted file mode 100644 index 9cfa502402..0000000000 --- a/programs/develop/libraries/menuetlibc/programs/plaympg/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -OUTFILE = plaympg -OBJS = main.o -LIBS = -lmpeg - -include $(MENUETDEV)/makefiles/Makefile_for_program diff --git a/programs/develop/libraries/menuetlibc/programs/plaympg/main.c b/programs/develop/libraries/menuetlibc/programs/plaympg/main.c deleted file mode 100644 index af184acd46..0000000000 --- a/programs/develop/libraries/menuetlibc/programs/plaympg/main.c +++ /dev/null @@ -1,139 +0,0 @@ -#include -#include -#include -#include - -ImageDesc I; -FILE * fmpeg=NULL; - -char * vblit_buffer=NULL; -char * bitmap_buffer=NULL; -int line_width; - -int blit_x_offs=0; -int blit_y_offs=0; - -int win_size_x=0; -int win_size_y=0; - -unsigned long inter_frame_delay; - -char player_window_title[256]; -char loaded_file_name[256]; - -enum { - st_STOP=0,st_PLAYING=1,st_PAUSE=2,st_NOMOVIE=3 -} play_state=st_NOMOVIE; - -#define __convert_line(from,to) \ -{ \ - int d0,d1,d2; \ - __asm__ __volatile__( \ - "1:\n\t" \ - "lodsw\n\t" \ - "stosw\n\t" \ - "lodsw\n\t" \ - "stosb\n\t" \ - "loop 1b" \ - :"=&c"(d0),"=&S"(d1),"=&D"(d2) \ - :"0"(line_width),"1"(from),"2"(to)); \ -} - -void convert_output_image(void) -{ - char * src=bitmap_buffer; - char * dst=vblit_buffer; - int i; - for(i=0;i "," ## "," /\\ "," \\/ "}; -static char * player_buttons2[]={"pause","play ","stop ","eject","load "}; - -#define BUTT_SIZE_X (5*8) -#define BUTT_SIZE_Y (2*12) - -void paint_player_buttons(void) -{ - int xpos,ypos,i; - xpos=5; - ypos=20; - for(i=0;i<5;i++) - { - __menuet__make_button(xpos,ypos,BUTT_SIZE_X,BUTT_SIZE_Y,i+2,0x40000000); - } -} - -void paint_player_window(void) -{ - __menuet__window_redraw(1); - if(play_state==st_NOMOVIE) - { - win_size_x=40*8; - win_size_y=200; - } else { - win_size_x=max(40*8,I.Width+20); - win_size_y=max(200,I.Height+50); - } - __menuet__define_window(100,100,win_size_x,win_size_y,0x03000080, - 0x800000FF,0x000080); - set_player_wnd_title(loaded_file_name); - if(play_state!=st_NOMOVIE) - { - blit_x_offs=10; - blit_y_offs=40; - __menuet__putimage(blit_x_offs,blit_y_offs,I.Width,I.Height,vblit_buffer); - } - paint_player_buttons(); - __menuet__window_redraw(2); -} diff --git a/programs/develop/libraries/menuetlibc/programs/rwtest/Makefile b/programs/develop/libraries/menuetlibc/programs/rwtest/Makefile deleted file mode 100644 index 9b76240ea8..0000000000 --- a/programs/develop/libraries/menuetlibc/programs/rwtest/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -OUTFILE = xtest -OBJS = test.o - -include $(MENUETDEV)/makefiles/Makefile_for_program diff --git a/programs/develop/libraries/menuetlibc/programs/rwtest/test.c b/programs/develop/libraries/menuetlibc/programs/rwtest/test.c deleted file mode 100644 index ba31aeeaf9..0000000000 --- a/programs/develop/libraries/menuetlibc/programs/rwtest/test.c +++ /dev/null @@ -1,33 +0,0 @@ -#include -#include - -char * xbuf; -unsigned long sz; - -int main(void) -{ - FILE * fp; - chdir("/hd/1/menuetos/doom"); - __libclog_printf("Opening file ..."); - fp=fopen("doom1.wad","rb"); - if(!fp) - { - __libclog_printf("failed\n"); - return 1; - } - __libclog_printf("OK\n"); - fseek(fp,0,SEEK_END); - sz=ftell(fp); - fseek(fp,0,SEEK_SET); - xbuf=malloc(sz); - if(!xbuf) - { - __libclog_printf("Unable to malloc %u bytes\n",sz); - return 1; - } - __libclog_printf("Reading ..."); - fread(xbuf,1,sz,fp); - __libclog_printf("done\n"); - fclose(fp); - return 0; -} diff --git a/programs/develop/libraries/menuetlibc/src/libc/Tupfile.lua b/programs/develop/libraries/menuetlibc/src/libc/Tupfile.lua new file mode 100644 index 0000000000..2bb0a0ed67 --- /dev/null +++ b/programs/develop/libraries/menuetlibc/src/libc/Tupfile.lua @@ -0,0 +1,85 @@ +if tup.getconfig("NO_GCC") ~= "" then return end +FOLDERS = { + "ansi/assert", + "ansi/ctype", + "ansi/errno", + "ansi/locale", + "ansi/math", + "ansi/setjmp", + "ansi/stdio", + "ansi/stdlib", + "ansi/string", + "ansi/time", + "ansif", + "compat/bsd", + "compat/io", + "compat/math", + "compat/mman", + "compat/mntent", + "compat/search", + "compat/signal", + "compat/stdio", + "compat/stdlib", + "compat/string", + "compat/sys/resource", + "compat/sys/stat", + "compat/sys/vfs", + "compat/termios", + "compat/time", + "compat/unistd", + "compat/v1", + "crt0", + "dos/compat", + "dos/dir", + "dos/dos", + "dos/dos_emu", + "dos/errno", + "dos/io", + "dos/process", + "dos/sys/timeb", + "fsext", + "menuetos", + "net", + "pc_hw/cpu", + "pc_hw/endian", + "pc_hw/farptr", + "pc_hw/fpu", + "pc_hw/hwint", + "pc_hw/kb", + "pc_hw/mem", + "pc_hw/sound", + "pc_hw/timer", + "posix/dirent", + "posix/fcntl", + "posix/fnmatch", + "posix/glob", + "posix/grp", +-- "posix/regex", -- not compilable + "posix/pwd", + "posix/setjmp", + "posix/signal", + "posix/stdio", + "posix/sys/stat", + "posix/sys/times", + "posix/sys/wait", + "posix/unistd", + "posix/utime", + "posix/utsname", + "termios", +} + +CFLAGS="-Os -fno-stack-check -fno-stack-protector -mno-stack-arg-probe -fno-ident -fomit-frame-pointer -fno-asynchronous-unwind-tables -mpreferred-stack-boundary=2" +OBJS={} +for i,v in ipairs(FOLDERS) do + tup.append_table(OBJS, + tup.foreach_rule({v .. "/*.c", extra_inputs = {"../../config.h"}}, + 'kos32-gcc -c -I../../include -D__DEV_CONFIG_H=\\"../../config.h\\" ' .. CFLAGS .. " -o %o %f", + v .. "/%B.o") + ) + tup.append_table(OBJS, + tup.foreach_rule({v .. "/*.s", extra_inputs = {"../../config.h"}}, + 'kos32-cpp -I../../include -D__DEV_CONFIG_H=\\"../../config.h\\" %f | kos32-as -o %o', + v .. "/%B.o") + ) +end +tup.rule(OBJS, "kos32-ar rcs %o %f", {"../../lib/libc.a", "../../"}) diff --git a/programs/develop/libraries/menuetlibc/src/libc/ansi/stdio/fprintf.c b/programs/develop/libraries/menuetlibc/src/libc/ansi/stdio/fprintf.c index 7a099a9a71..93c6094aca 100644 --- a/programs/develop/libraries/menuetlibc/src/libc/ansi/stdio/fprintf.c +++ b/programs/develop/libraries/menuetlibc/src/libc/ansi/stdio/fprintf.c @@ -1,5 +1,6 @@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ #include +#include #include int diff --git a/programs/develop/libraries/menuetlibc/src/libc/compat/bsd/bcopy.c b/programs/develop/libraries/menuetlibc/src/libc/compat/bsd/bcopy.c index df54851777..bc96f9586a 100644 --- a/programs/develop/libraries/menuetlibc/src/libc/compat/bsd/bcopy.c +++ b/programs/develop/libraries/menuetlibc/src/libc/compat/bsd/bcopy.c @@ -3,8 +3,8 @@ #undef bcopy -void * +void bcopy(const void *a, void *b, size_t len) { - return memmove(b, a, len); + memmove(b, a, len); } diff --git a/programs/develop/libraries/menuetlibc/src/libc/compat/bsd/bzero.c b/programs/develop/libraries/menuetlibc/src/libc/compat/bsd/bzero.c index c8b09c1ff7..d52ae27e2b 100644 --- a/programs/develop/libraries/menuetlibc/src/libc/compat/bsd/bzero.c +++ b/programs/develop/libraries/menuetlibc/src/libc/compat/bsd/bzero.c @@ -3,8 +3,8 @@ #undef bzero -void * +void bzero(void *a, size_t b) { - return memset(a,0,b); + memset(a,0,b); } diff --git a/programs/develop/libraries/menuetlibc/src/libc/compat/math/sincos.s b/programs/develop/libraries/menuetlibc/src/libc/compat/math/sincos.s index e7f28b03ee..770f4cc1a4 100644 --- a/programs/develop/libraries/menuetlibc/src/libc/compat/math/sincos.s +++ b/programs/develop/libraries/menuetlibc/src/libc/compat/math/sincos.s @@ -6,18 +6,18 @@ NaN: MK_C_SYM(sincos) - /* void sincos(double *cosine, double *sine, double x); */ + /* void sincos(double x, double *sine, double *cosine); */ - movl 16(%esp), %ecx + movl 8(%esp), %ecx - movl 4(%esp), %eax /* Point to cosine. */ - movl 8(%esp), %edx /* Point to sine. */ + movl 16(%esp), %eax /* Point to cosine. */ + movl 12(%esp), %edx /* Point to sine. */ andl $0x7FF00000, %ecx /* Examine exponent of x. */ cmpl $0x43E00000, %ecx /* |x| >= 2^63 */ jae bigarg - fldl 12(%esp) + fldl 4(%esp) fsincos fstpl (%eax) /* cos */ fstpl (%edx) /* sin */ diff --git a/programs/develop/libraries/menuetlibc/src/libc/dos/dos_emu/fslayer.c b/programs/develop/libraries/menuetlibc/src/libc/dos/dos_emu/fslayer.c deleted file mode 100644 index 5b7137fd90..0000000000 --- a/programs/develop/libraries/menuetlibc/src/libc/dos/dos_emu/fslayer.c +++ /dev/null @@ -1,287 +0,0 @@ -#include -#include -#include -#include -#include -#include - -struct systree_blk -{ - unsigned long cmd,pos,blks; - void * data,* work; - char name[256]; -} __attribute__((packed)); - -typedef struct EMU_FILE -{ - int handle; - unsigned long size; - unsigned long pos; - unsigned long mode; - unsigned long current_sector; - unsigned long size_sectors; - char * write_buf; - unsigned long write_bufsize; - char rd_buffer[512]; - char name[256]; - unsigned char dirty; -} EMU_FILE; - -#define _MAX_HANDLES 64 - -static EMU_FILE * EMU_file_table[_MAX_HANDLES]; -static char systree_work_area[16384+512]; -static volatile struct systree_blk sblk; -static volatile int S_eax,S_ebx; - -static inline int EMU_alloc_handle(void) -{ - register int i; - for(i=0;i<_MAX_HANDLES;i++) - if(!EMU_file_table[i]) - { - EMU_file_table[i]=(EMU_FILE *)malloc(sizeof(EMU_FILE)); - if(!EMU_file_table[i]) return -ENOMEM; - return i; - } - return -EAGAIN; -} - -static inline int EMU_systree_cmd(void) -{ - __asm__ __volatile__("int $0x40" - :"=a"(S_eax),"=b"(S_ebx) - :"0"(58),"1"((void *)&sblk)); - return S_eax; -} - -static int EMU_loadsector(EMU_FILE * filp) -{ - sblk.cmd=0; - sblk.pos=filp->current_sector; - sblk.blks=1; - sblk.data=filp->rd_buffer; - sblk.work=systree_work_area; - memcpy((void *)&sblk.name,(const void *)filp->name,strlen(filp->name)+1); - return EMU_systree_cmd(); -} - -static int EMU_fsync(EMU_FILE * filp) -{ - if(filp->mode==O_RDONLY) return 0; - if(!filp->dirty) return 0; - filp->dirty=0; - sblk.cmd=1; - sblk.pos=0; - sblk.blks=filp->size; - sblk.data=filp->write_buf; - sblk.work=systree_work_area; - memcpy((void *)sblk.name,(const void *)filp->name,strlen(filp->name)+1); - return EMU_systree_cmd(); -} - -static inline int EMU_realloc_buf(EMU_FILE * filp,unsigned long newsize) -{ - char * n; - newsize=(newsize+511)&~511; - if(filp->write_bufsize==newsize) return 0; - n=(char *)realloc(filp->write_buf,newsize); - if(!n) return -ENOSPC; - filp->write_buf=n; - filp->write_bufsize=newsize; - filp->dirty=1; - return 0; -} - -static int EMU_createtrunc(char * fname) -{ - sblk.cmd=1; - sblk.pos=0; - sblk.blks=0; - sblk.data=sblk.work=systree_work_area; - memcpy((void *)sblk.name,(const void *)fname,strlen(fname)+1); - return EMU_systree_cmd(); -} - -static int EMU_getfsize(char * fname,unsigned long * sizep) -{ - sblk.cmd=0; - sblk.pos=0; - sblk.blks=1; - sblk.data=systree_work_area+16384; - sblk.work=systree_work_area; - memcpy((void *)sblk.name,(const void *)fname,strlen(fname)+1); - if(EMU_systree_cmd()!=0) return -EINVAL; - if(sizep) *sizep=(unsigned long)S_ebx; - return 0; -} - -static int EMU_open(char * fname,int mode) -{ - EMU_FILE * filp; - register int hid; - unsigned long iomode; - hid=EMU_alloc_handle(); - if(hid<0) return hid; - filp=EMU_file_table[hid]; - filp->handle=hid; - iomode=mode&(O_RDONLY|O_WRONLY|O_RDWR); - memcpy((void *)filp->name,(const void *)fname,strlen(fname)+1); - strupr(filp->name); - filp->mode=iomode; - if(mode&O_CREAT) - { - int createflags=mode&(O_TRUNC|O_EXCL); - if(createflags&O_EXCL) - { - unsigned long psz=0; - if(EMU_getfsize(filp->name,&psz)==0) - { - free(EMU_file_table[hid=filp->handle]); - EMU_file_table[hid]=NULL; - return -EEXIST; - } - } - if(createflags&O_TRUNC) - { - EMU_createtrunc(filp->name); - } - } - if(iomode==O_RDONLY) - { - hid=EMU_getfsize(filp->name,&filp->size); - if(hid<0) - { - free(EMU_file_table[hid=filp->handle]); - EMU_file_table[hid]=NULL; - return -ENOENT; - } - filp->current_sector=0; - if(EMU_loadsector(filp)<0) filp->current_sector=-1UL; - filp->mode=O_RDONLY; - filp->size_sectors=(filp->size+511)/512; - filp->write_bufsize=0; - filp->dirty=0; - return filp->handle; - } - if(iomode==O_WRONLY) - { - hid=EMU_getfsize(filp->name,&filp->size); - if(hid<0) - { -BAD_WRO: - free(EMU_file_table[hid=filp->handle]); - EMU_file_table[hid]=NULL; - return -ENOENT; - } - filp->current_sector=-1UL; - filp->mode=O_WRONLY; - filp->size_sectors=0; - filp->write_bufsize=(filp->size+511)&~511; - filp->write_buf=(char *)malloc(filp->write_bufsize); - if(!filp->write_buf) - { - free(filp->write_buf); - goto BAD_WRO; - } - sblk.cmd=0; - sblk.pos=0; - sblk.blks=filp->write_bufsize/512; - sblk.data=filp->write_buf; - sblk.work=systree_work_area; - if(EMU_systree_cmd()!=0) goto BAD_WRO1; - return filp->handle; - } - hid=EMU_getfsize(filp->name,&filp->size); - if(hid<0) - { -BAD_WRO1: - free(EMU_file_table[hid=filp->handle]); - EMU_file_table[hid]=NULL; - return -ENOENT; - } - filp->current_sector=-1UL; - filp->mode=O_RDWR; - filp->size_sectors=0; - filp->write_bufsize=(filp->size+511)&~511; - filp->write_buf=(char *)malloc(filp->write_bufsize); - if(!filp->write_buf) - { - free(filp->write_buf); - goto BAD_WRO1; - } - sblk.cmd=0; - sblk.pos=0; - sblk.blks=filp->write_bufsize/512; - sblk.data=filp->write_buf; - sblk.work=systree_work_area; - if(EMU_systree_cmd()!=0) goto BAD_WRO1; - return filp->handle; -} - -static int EMU_close(EMU_FILE * filp) -{ - int hid; - if(!filp) return -ENOENT; - if(EMU_file_table[hid=filp->handle]!=filp) return -EBADF; - if(filp->write_buf) free(filp->write_buf); - free(filp); - EMU_file_table[hid]=NULL; - return 0; -} - -static int EMU_lseek(EMU_FILE * filp,unsigned long off,int whence) -{ - unsigned long newpos; - switch(whence) - { - case SEEK_SET: - newpos=off; - break; - case SEEK_CUR: - newpos=filp->pos+off; - break; - case SEEK_END: - newpos=filp->size+off-1; - break; - } - if(newpos>=filp->size) return -1; - filp->pos=newpos; - return filp->pos; -} - -static int EMU_read(EMU_FILE * filp,unsigned long size,void * buf) -{ - int icount,curr_sector,curr_sector_ofs,n; - int nbufbytes,totalremaining; - if(filp->pos+count>filp->size) - count=filp->size-filp->pos; - if(filp->mode==O_RDWR) - { - memcpy(buffer,filp->write_buf+filp->pos,count); - filp->pos+=count; - return count; - } - icount=count; - while(count>0) - { - if(filp->pos>=filp->size) return icount=count; - curr_sector=sh->pointer>>9; - curr_sector_ofs=sh->pointer&511; - n=count; - if(sh->bufsector==-1 || curr_sector!=sh->bufsector) - { - if(dosemu_loadcurrsector(sh)==-1) return -1; - } - nbufbytes=512-curr_sector_ofs; - totalremaining=sh->size-sh->pointer; - if(nbufbytes>totalremaining) nbufbytes=totalremaining; - if(n>nbufbytes) n=nbufbytes; - memcpy(buffer,&sh->buf[curr_sector_ofs],n); - buffer+=n; - count-=n; - sh->pointer+=n; - } - return icount; -} -} diff --git a/programs/develop/libraries/menuetlibc/src/libcpp/Tupfile.lua b/programs/develop/libraries/menuetlibc/src/libcpp/Tupfile.lua new file mode 100644 index 0000000000..b7220a101f --- /dev/null +++ b/programs/develop/libraries/menuetlibc/src/libcpp/Tupfile.lua @@ -0,0 +1,6 @@ +if tup.getconfig('NO_GCC') ~= "" then return end +CFLAGS = "-Os -fno-stack-check -fno-stack-protector -mno-stack-arg-probe -fno-ident -fomit-frame-pointer -fno-asynchronous-unwind-tables -mpreferred-stack-boundary=2" +OBJS = tup.foreach_rule({"*.cpp", extra_inputs = {"../../config.h"}}, + 'kos32-gcc -c -I../../include -D__DEV_CONFIG_H=\\"../../config.h\\" ' .. CFLAGS .. " -o %o %f", + "%B.o") +tup.rule(OBJS, "kos32-ar rcs %o %f", {"../../lib/libcpp.a", "../../"}) diff --git a/programs/develop/libraries/menuetlibc/src/libm/Tupfile.lua b/programs/develop/libraries/menuetlibc/src/libm/Tupfile.lua new file mode 100644 index 0000000000..feeceeefe4 --- /dev/null +++ b/programs/develop/libraries/menuetlibc/src/libm/Tupfile.lua @@ -0,0 +1,9 @@ +if tup.getconfig('NO_GCC') ~= "" then return end +CFLAGS="-D_USE_LIBM_MATH_H -Os -fno-stack-check -fno-stack-protector -mno-stack-arg-probe -fno-ident -fomit-frame-pointer -fno-asynchronous-unwind-tables -mpreferred-stack-boundary=2" +OBJS = tup.foreach_rule({"*.c", extra_inputs = {"../../config.h"}}, + 'kos32-gcc -c -I../../include -D__DEV_CONFIG_H=\\"../../config.h\\" ' .. CFLAGS .. ' -o %o %f', + "%B.o") +OBJS += tup.foreach_rule({"*.s", extra_inputs = {"../../config.h"}}, + 'kos32-cpp -I../../include -D__DEV_CONFIG_H=\\"../../config.h\\" %f | kos32-as -o %o', + "%B.o") +tup.rule(OBJS, "kos32-ar rcs %o %f", {"../../lib/libm.a", "../../"}) diff --git a/programs/develop/libraries/menuetlibc/src/libm/ef_sinh.s b/programs/develop/libraries/menuetlibc/src/libm/ef_sinh.s deleted file mode 100644 index eea47577d6..0000000000 --- a/programs/develop/libraries/menuetlibc/src/libm/ef_sinh.s +++ /dev/null @@ -1,8 +0,0 @@ - .file "ef_sinh.c" - .text - .align 4 -_one: - .long 1065353216 - .align 4 -_shuge: - .long 2096152002 diff --git a/programs/develop/libraries/menuetlibc/src/libm/k_standa.c b/programs/develop/libraries/menuetlibc/src/libm/k_standa.c index 3d350590f1..46b51624de 100644 --- a/programs/develop/libraries/menuetlibc/src/libm/k_standa.c +++ b/programs/develop/libraries/menuetlibc/src/libm/k_standa.c @@ -28,6 +28,8 @@ static char rcsid[] = "$Id: k_standard.c,v 1.4 1994/08/10 20:31:44 jtc Exp $"; #undef fflush #endif /* !defined(_USE_WRITE) */ +inline int fputs(const char* str, FILE* f) { return -1; } + #ifdef __STDC__ static const double zero = 0.0; /* used as const */ #else diff --git a/programs/develop/libraries/menuetlibc/stub/Tupfile.lua b/programs/develop/libraries/menuetlibc/stub/Tupfile.lua new file mode 100644 index 0000000000..1e2113701b --- /dev/null +++ b/programs/develop/libraries/menuetlibc/stub/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("crt0_coff.asm", "fasm %f %o", "crt0.o") diff --git a/programs/develop/libraries/menuetlibc/stub/crt0_coff.asm b/programs/develop/libraries/menuetlibc/stub/crt0_coff.asm index 96e27de1d6..f854b41647 100644 --- a/programs/develop/libraries/menuetlibc/stub/crt0_coff.asm +++ b/programs/develop/libraries/menuetlibc/stub/crt0_coff.asm @@ -7,6 +7,7 @@ public start EXTRN ___menuet__app_param_area EXTRN ___menuet__app_path_area EXTRN ___crt1_startup +EXTRN ___memsize start: public ___menuet__app_header public ___menuet__memsize @@ -22,7 +23,7 @@ end if ; dd _edata dd 0 ___menuet__memsize: - dd 0x400000 + dd ___memsize dd app_stack dd ___menuet__app_param_area dd ___menuet__app_path_area @@ -54,5 +55,6 @@ _libc_null_call: end if section '.bss' readable writeable -rd 0x20000 +;rd 0x20000 +rb 0x10000 app_stack: diff --git a/programs/develop/libraries/menuetlibc/programs/binclock/Makefile b/programs/develop/libraries/menuetlibc_example/Makefile similarity index 100% rename from programs/develop/libraries/menuetlibc/programs/binclock/Makefile rename to programs/develop/libraries/menuetlibc_example/Makefile diff --git a/programs/develop/libraries/menuetlibc_example/Tupfile.lua b/programs/develop/libraries/menuetlibc_example/Tupfile.lua new file mode 100644 index 0000000000..09b1b52a44 --- /dev/null +++ b/programs/develop/libraries/menuetlibc_example/Tupfile.lua @@ -0,0 +1,6 @@ +if tup.getconfig('NO_GCC') ~= "" then return end +HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../.." or tup.getconfig("HELPERDIR") +tup.include(HELPERDIR .. "/use_gcc.lua") +tup.include(HELPERDIR .. "/use_menuetlibc.lua") +compile_gcc{"main.c"} +link_gcc("binclock") diff --git a/programs/develop/libraries/menuetlibc/programs/binclock/main.c b/programs/develop/libraries/menuetlibc_example/main.c similarity index 86% rename from programs/develop/libraries/menuetlibc/programs/binclock/main.c rename to programs/develop/libraries/menuetlibc_example/main.c index e39ae6b5c8..045bc2f7e0 100644 --- a/programs/develop/libraries/menuetlibc/programs/binclock/main.c +++ b/programs/develop/libraries/menuetlibc_example/main.c @@ -4,12 +4,12 @@ static char * Title="BinClock"; -void draw_small_box(int x,int y,int is_on) +static void draw_small_box(int x,int y,int is_on) { __menuet__bar(x,y,B_SZ,B_SZ,is_on ? 0xFF0000 : 0x103000); } -void draw_box_group(int x,int y,int num) +static void draw_box_group(int x,int y,int num) { int i,j; char buf[2]; @@ -24,7 +24,7 @@ void draw_box_group(int x,int y,int num) __menuet__write_text(x+2,y+((B_SZ+2)*4)+3,0xFFFFFF,buf,1); } -void draw_bcd_num(int x,int y,int num) +static void draw_bcd_num(int x,int y,int num) { int v1,v2; v1=(num>>4)&(1+2+4+8); @@ -33,7 +33,7 @@ void draw_bcd_num(int x,int y,int num) draw_box_group(x+B_SZ+2,y,v2); } -void draw_hms(int x,int y) +static void draw_hms(int x,int y) { __u32 t; int h,m,s; @@ -48,12 +48,12 @@ void draw_hms(int x,int y) draw_bcd_num(x,y,s); } -void draw_h(void) +static void draw_h(void) { draw_hms(22,28); } -void paint(void) +static void paint(void) { __menuet__window_redraw(1); __menuet__define_window(100,100,40+((B_SZ+2)*6)+4,30+((B_SZ+2)*4)+16,0x03000080,0x800000FF,0x000080); diff --git a/programs/develop/libraries/msgbox/Tupfile.lua b/programs/develop/libraries/msgbox/Tupfile.lua new file mode 100644 index 0000000000..12c6612878 --- /dev/null +++ b/programs/develop/libraries/msgbox/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("msgbox.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "msgbox.obj") diff --git a/programs/develop/libraries/network/Tupfile.lua b/programs/develop/libraries/network/Tupfile.lua new file mode 100644 index 0000000000..949e42d43c --- /dev/null +++ b/programs/develop/libraries/network/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("network.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "network.obj") diff --git a/programs/develop/libraries/network/examples/Tupfile.lua b/programs/develop/libraries/network/examples/Tupfile.lua new file mode 100644 index 0000000000..031b2acf94 --- /dev/null +++ b/programs/develop/libraries/network/examples/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("nslookup.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "nslookup") diff --git a/programs/develop/libraries/pixlib/Tupfile.lua b/programs/develop/libraries/pixlib/Tupfile.lua new file mode 100644 index 0000000000..872fb28d27 --- /dev/null +++ b/programs/develop/libraries/pixlib/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_GCC") ~= "" then return end +tup.rule("pixlib.c", "kos32-gcc -march=pentium-mmx -fno-ident -Os -c -o %o %f " .. tup.getconfig("KPACK_CMD"), "pixlib.obj") diff --git a/programs/develop/libraries/proc_lib/trunk/Tupfile.lua b/programs/develop/libraries/proc_lib/trunk/Tupfile.lua new file mode 100644 index 0000000000..74486e6e9d --- /dev/null +++ b/programs/develop/libraries/proc_lib/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("proc_lib.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "proc_lib.obj") diff --git a/programs/develop/libraries/qs/Tupfile.lua b/programs/develop/libraries/qs/Tupfile.lua new file mode 100644 index 0000000000..1cd16a2ad6 --- /dev/null +++ b/programs/develop/libraries/qs/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_GCC") ~= "" then return end +tup.rule("qs.c", "kos32-gcc -fno-ident -Os -c -o %o %f " .. tup.getconfig("KPACK_CMD"), "qs.obj") diff --git a/programs/develop/libraries/sorter/Tupfile.lua b/programs/develop/libraries/sorter/Tupfile.lua new file mode 100644 index 0000000000..a31f93da2d --- /dev/null +++ b/programs/develop/libraries/sorter/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("sort.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "sort.obj") diff --git a/programs/develop/libraries/ufmod/Fasm/Tupfile.lua b/programs/develop/libraries/ufmod/Fasm/Tupfile.lua new file mode 100644 index 0000000000..f6f917190c --- /dev/null +++ b/programs/develop/libraries/ufmod/Fasm/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"mini.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "mini") diff --git a/programs/develop/libraries/ufmod/Tupfile.lua b/programs/develop/libraries/ufmod/Tupfile.lua new file mode 100644 index 0000000000..875a949981 --- /dev/null +++ b/programs/develop/libraries/ufmod/Tupfile.lua @@ -0,0 +1,32 @@ +if tup.getconfig("NO_FASM") ~= "" then return end + +-- Select mixing rate: 22050, 44100 or 48000 (22.05 KHz, 44.1 KHz or 48 KHz) +UF_FREQ="48000" + +-- Set volume ramping mode (interpolation): NONE, WEAK or STRONG +UF_RAMP="STRONG" + +-- Set build mode: NORMAL, UNSAFE or AC97SND +UF_MODE="NORMAL" + +if tup.getconfig("TUP_PLATFORM") == "win32" +then tup.rule( + "echo UF_FREQ equ $(UF_FREQ) > %o && " .. + "echo UF_RAMP equ $(UF_RAMP) >> %o && " .. + "echo UF_MODE equ $(UF_MODE) >> %o && " .. + "echo DEBUG equ 0 >> %o && " .. + "echo NOLINKER equ 0 >> %o && " .. + "echo include 'eff.inc' >> %o && " .. + "echo include 'fasm.asm' >> %o", + {"tmp.asm"}) +else tup.rule( + "echo UF_FREQ equ $(UF_FREQ) > %o && " .. + "echo UF_RAMP equ $(UF_RAMP) >> %o && " .. + "echo UF_MODE equ $(UF_MODE) >> %o && " .. + "echo DEBUG equ 0 >> %o && " .. + "echo NOLINKER equ 0 >> %o && " .. + "echo include \"'eff.inc'\" >> %o && " .. + "echo include \"'fasm.asm'\" >> %o", + {"tmp.asm"}) +end +tup.rule("tmp.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "ufmod.obj") diff --git a/programs/develop/libraries/utils/trunk/Tupfile.lua b/programs/develop/libraries/utils/trunk/Tupfile.lua new file mode 100644 index 0000000000..9457634bae --- /dev/null +++ b/programs/develop/libraries/utils/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("utils.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "utils.obj") diff --git a/programs/develop/libraries/wword/Tupfile.lua b/programs/develop/libraries/wword/Tupfile.lua new file mode 100644 index 0000000000..653024a09f --- /dev/null +++ b/programs/develop/libraries/wword/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("wword.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "wword.obj") diff --git a/programs/develop/mstate/Tupfile.lua b/programs/develop/mstate/Tupfile.lua new file mode 100644 index 0000000000..513abdfe36 --- /dev/null +++ b/programs/develop/mstate/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_NASM") ~= "" then return end +tup.rule("mstate.asm", "nasm -t -f bin -o %o %f " .. tup.getconfig("KPACK_CMD"), "mstate") diff --git a/programs/develop/mstate/mstate.asm b/programs/develop/mstate/mstate.asm index 63576df02e..aee4def175 100644 --- a/programs/develop/mstate/mstate.asm +++ b/programs/develop/mstate/mstate.asm @@ -77,11 +77,11 @@ STATE_VALUES_LEFT equ (MOUSE_WIDTH - STATE_VALUES_WIDTH) / 2 + M MENUET01 db 'MENUET01' version dd 1 program.start dd START -program.end dd END -program.memory dd END + PATH_SIZE + PARAMS_SIZE + STACK_SIZE -program.stack dd END + PATH_SIZE + PARAMS_SIZE + STACK_SIZE -program.params dd END + PATH_SIZE -program.path dd END +program.end dd _END +program.memory dd _END + PATH_SIZE + PARAMS_SIZE + STACK_SIZE +program.stack dd _END + PATH_SIZE + PARAMS_SIZE + STACK_SIZE +program.params dd _END + PATH_SIZE +program.path dd _END ; ---------------------------------------------------------------------------- ; mouse_body_color dd MOUSE_BODY_COLOR mouse_left_button_color dd MOUSE_LEFT_BUTTON_COLOR @@ -243,4 +243,4 @@ on_button: ; terminate because we have only one button(close button) int 64 ; ---------------------------------------------------------------------------- ; align 4 -END: \ No newline at end of file +_END: diff --git a/programs/develop/mtdbg/Tupfile.lua b/programs/develop/mtdbg/Tupfile.lua new file mode 100644 index 0000000000..97d6f10f1b --- /dev/null +++ b/programs/develop/mtdbg/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("mtdbg.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "mtdbg") diff --git a/programs/develop/param/trunk/Tupfile.lua b/programs/develop/param/trunk/Tupfile.lua new file mode 100644 index 0000000000..82dad175e2 --- /dev/null +++ b/programs/develop/param/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"param.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "param") diff --git a/programs/develop/scancode/trunk/Tupfile.lua b/programs/develop/scancode/trunk/Tupfile.lua new file mode 100644 index 0000000000..2a5c947d2d --- /dev/null +++ b/programs/develop/scancode/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"scancode.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "scancode") diff --git a/programs/develop/scc/Cc1.asm b/programs/develop/scc/CC1.ASM similarity index 100% rename from programs/develop/scc/Cc1.asm rename to programs/develop/scc/CC1.ASM diff --git a/programs/develop/scc/Cc2.asm b/programs/develop/scc/CC2.ASM similarity index 100% rename from programs/develop/scc/Cc2.asm rename to programs/develop/scc/CC2.ASM diff --git a/programs/develop/scc/Cc3.asm b/programs/develop/scc/CC3.ASM similarity index 100% rename from programs/develop/scc/Cc3.asm rename to programs/develop/scc/CC3.ASM diff --git a/programs/develop/scc/OSFUNC.ASM b/programs/develop/scc/OSFUNC.ASM index 9f68d98f55..04eede57e7 100644 --- a/programs/develop/scc/OSFUNC.ASM +++ b/programs/develop/scc/OSFUNC.ASM @@ -1,4 +1,4 @@ -include "macros.inc" +include "MACROS.INC" ; ; OS function implementation ; SmallC for KolibriOS diff --git a/programs/develop/scc/Tupfile.lua b/programs/develop/scc/Tupfile.lua new file mode 100644 index 0000000000..c1973b5702 --- /dev/null +++ b/programs/develop/scc/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("SCC.ASM", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "SCC") diff --git a/programs/develop/sdk/trunk/pixlib/Tupfile.lua b/programs/develop/sdk/trunk/pixlib/Tupfile.lua new file mode 100644 index 0000000000..b34ba0b9da --- /dev/null +++ b/programs/develop/sdk/trunk/pixlib/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.foreach_rule("*.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "%B") diff --git a/programs/develop/sdk/trunk/sound/src/Tupfile.lua b/programs/develop/sdk/trunk/sound/src/Tupfile.lua new file mode 100644 index 0000000000..1658328cfa --- /dev/null +++ b/programs/develop/sdk/trunk/sound/src/Tupfile.lua @@ -0,0 +1,7 @@ +if tup.getconfig("NO_FASM") ~= "" or (tup.getconfig("NO_MSVC") ~= "" and tup.getconfig("NO_GCC") ~= "") then return end + +OBJS = tup.foreach_rule("*.asm", "fasm %f %o", "%B.obj") +if tup.getconfig("NO_GCC") == "" +then tup.rule(OBJS, "kos32-ar rcs %o %f", "sound.lib") +else tup.rule(OBJS, "link.exe /lib /out:%o %f", "sound.lib") +end diff --git a/programs/develop/str_double/trunk/Tupfile.lua b/programs/develop/str_double/trunk/Tupfile.lua new file mode 100644 index 0000000000..7d5ae87609 --- /dev/null +++ b/programs/develop/str_double/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"str_double.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "str_double") diff --git a/programs/develop/tinypad/trunk/Tupfile.lua b/programs/develop/tinypad/trunk/Tupfile.lua new file mode 100644 index 0000000000..ddffda3e30 --- /dev/null +++ b/programs/develop/tinypad/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"tinypad.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "tinypad") diff --git a/programs/emulator/PrMK/trunk/PrMK.asm b/programs/emulator/PrMK/trunk/PrMK.asm index 03bdbf4fe8..16ab663a0e 100644 --- a/programs/emulator/PrMK/trunk/PrMK.asm +++ b/programs/emulator/PrMK/trunk/PrMK.asm @@ -1792,19 +1792,19 @@ edit1 edit_box 20,427,320,0xffffff,0x6a9480,0,0xAABBCC,0,2,txt.edbox,ed_focus,ed edit2 edit_box 240,2,2,0xffffff,0x6a9480,0,0xAABBCC,0,4096,buf_cmd_lin,ed_focus,2,0,0 virtual at 0 -file 'MK_b3-34_hand.BMP':0xA,4 +file 'MK_b3-34_hand.bmp':0xA,4 load offbits dword from 0 end virtual palitra: - file 'MK_b3-34_hand.BMP':0x36,offbits-0x36 + file 'MK_b3-34_hand.bmp':0x36,offbits-0x36 sizey = 262 sizex = 185 + 7 smesh = 3 bmp_file: - file 'MK_b3-34_hand.BMP':110 + file 'MK_b3-34_hand.bmp':110 repeat sizey/2 y = % - 1 z = sizey - % diff --git a/programs/emulator/PrMK/trunk/Tupfile.lua b/programs/emulator/PrMK/trunk/Tupfile.lua new file mode 100644 index 0000000000..8a03e2808f --- /dev/null +++ b/programs/emulator/PrMK/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("PrMK.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "PrMK") diff --git a/programs/emulator/PrMK/trunk/LOAD_LIB.MAC b/programs/emulator/PrMK/trunk/load_lib.mac similarity index 100% rename from programs/emulator/PrMK/trunk/LOAD_LIB.MAC rename to programs/emulator/PrMK/trunk/load_lib.mac diff --git a/programs/emulator/e80/trunk/Tupfile.lua b/programs/emulator/e80/trunk/Tupfile.lua new file mode 100644 index 0000000000..ce9d3b2271 --- /dev/null +++ b/programs/emulator/e80/trunk/Tupfile.lua @@ -0,0 +1,18 @@ +if tup.getconfig("NO_FASM") ~= "" or tup.getconfig("NO_GCC") ~= "" then return end +HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../.." or tup.getconfig("HELPERDIR") +tup.include(HELPERDIR .. "/use_gcc.lua") +LDFLAGS = LDFLAGS .. " -T kolibri.ld" +if tup.getconfig("LANG") == "ru" +then C_LANG = "LANG_RUS" +else C_LANG = "LANG_ENG" -- this includes default case without config +end + +if tup.getconfig("TUP_PLATFORM") == "win32" +-- on win32 '#' is not a special character, but backslash and quotes would be printed as is +then tup.rule('echo #define ' .. C_LANG .. ' 1 > %o', {"lang.h"}) +-- on unix '#' should be escaped +else tup.rule('echo "#define" ' .. C_LANG .. ' 1 > %o', {"lang.h"}) +end +tup.append_table(OBJS, tup.rule("asm_code.asm", "fasm %f %o", "asm_code.obj")) +compile_gcc{"z80/z80.c", "system/kolibri.c", "system/stdlib.c", "system/string.c", "e80.c", extra_inputs = {"lang.h"}} +link_gcc("e80") diff --git a/programs/emulator/e80/trunk/kolibri.ld b/programs/emulator/e80/trunk/kolibri.ld index 23841f98db..5108410375 100644 --- a/programs/emulator/e80/trunk/kolibri.ld +++ b/programs/emulator/e80/trunk/kolibri.ld @@ -17,4 +17,8 @@ SECTIONS *(.bss) } Memory = . ; + /DISCARD/ : { + *(.comment) + *(.drectve) + } } diff --git a/programs/emulator/e80/trunk/system/kolibri.h b/programs/emulator/e80/trunk/system/kolibri.h index ae3cd2ebc5..ec9aa1fce0 100644 --- a/programs/emulator/e80/trunk/system/kolibri.h +++ b/programs/emulator/e80/trunk/system/kolibri.h @@ -12,39 +12,40 @@ #define E_NOMEM 30 #define E_PARAM 33 - +#pragma pack(push, 1) typedef struct { -unsigned p00 __attribute__((packed)); -unsigned p04 __attribute__((packed)); -unsigned p08 __attribute__((packed)); -unsigned p12 __attribute__((packed)); -unsigned p16 __attribute__((packed)); -char p20 __attribute__((packed)); -char *p21 __attribute__((packed)); -} kol_struct70 __attribute__((packed)); +unsigned p00; +unsigned p04; +unsigned p08; +unsigned p12; +unsigned p16; +char p20; +char *p21; +} kol_struct70; typedef struct { -unsigned p00 __attribute__((packed)); -char p04 __attribute__((packed)); -char p05[3] __attribute__((packed)); -unsigned p08 __attribute__((packed)); -unsigned p12 __attribute__((packed)); -unsigned p16 __attribute__((packed)); -unsigned p20 __attribute__((packed)); -unsigned p24 __attribute__((packed)); -unsigned p28 __attribute__((packed)); -unsigned p32[2] __attribute__((packed)); -unsigned p40 __attribute__((packed)); -} kol_struct_BDVK __attribute__((packed)); +unsigned p00; +char p04; +char p05[3]; +unsigned p08; +unsigned p12; +unsigned p16; +unsigned p20; +unsigned p24; +unsigned p28; +unsigned p32[2]; +unsigned p40; +} kol_struct_BDVK; typedef struct { -char *name __attribute__((packed)); -void *data __attribute__((packed)); -} kol_struct_import __attribute__((packed)); +char *name; +void *data; +} kol_struct_import; +#pragma pack(pop) void kol_exit(); diff --git a/programs/emulator/e80/trunk/utils/keyZXtst/Tupfile.lua b/programs/emulator/e80/trunk/utils/keyZXtst/Tupfile.lua new file mode 100644 index 0000000000..58d8743477 --- /dev/null +++ b/programs/emulator/e80/trunk/utils/keyZXtst/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("keyZXtst.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "keyZXtst") diff --git a/programs/fs/copy2/trunk/Tupfile.lua b/programs/fs/copy2/trunk/Tupfile.lua new file mode 100644 index 0000000000..40f83c6c9a --- /dev/null +++ b/programs/fs/copy2/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"copy2.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "copy2") diff --git a/programs/fs/copyr/trunk/Tupfile.lua b/programs/fs/copyr/trunk/Tupfile.lua new file mode 100644 index 0000000000..77410e5d9a --- /dev/null +++ b/programs/fs/copyr/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"copyr.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "copyr") diff --git a/programs/fs/fspeed/Tupfile.lua b/programs/fs/fspeed/Tupfile.lua new file mode 100644 index 0000000000..96eba87810 --- /dev/null +++ b/programs/fs/fspeed/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"fspeed.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "fspeed") diff --git a/programs/fs/kfar/trunk/Tupfile.lua b/programs/fs/kfar/trunk/Tupfile.lua new file mode 100644 index 0000000000..ea13d98a89 --- /dev/null +++ b/programs/fs/kfar/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"kfar.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "kfar") diff --git a/programs/fs/kfar/trunk/kfar_arc/Tupfile.lua b/programs/fs/kfar/trunk/kfar_arc/Tupfile.lua new file mode 100644 index 0000000000..ac790f3ece --- /dev/null +++ b/programs/fs/kfar/trunk/kfar_arc/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"kfar_arc.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "kfar_arc.obj") diff --git a/programs/fs/kfm/trunk/Tupfile.lua b/programs/fs/kfm/trunk/Tupfile.lua new file mode 100644 index 0000000000..aa94dc651e --- /dev/null +++ b/programs/fs/kfm/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"kfm.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "kfm") diff --git a/programs/fs/opendial/Tupfile.lua b/programs/fs/opendial/Tupfile.lua new file mode 100644 index 0000000000..368fd51731 --- /dev/null +++ b/programs/fs/opendial/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("opendial.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "opendial") diff --git a/programs/fs/sysxtree/trunk/Tupfile.lua b/programs/fs/sysxtree/trunk/Tupfile.lua new file mode 100644 index 0000000000..b362d2a28d --- /dev/null +++ b/programs/fs/sysxtree/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("sysxtree.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "sysxtree") diff --git a/programs/games/15/trunk/Tupfile.lua b/programs/games/15/trunk/Tupfile.lua new file mode 100644 index 0000000000..c8476a247c --- /dev/null +++ b/programs/games/15/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"15.ASM", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "15") diff --git a/programs/games/FindNumbers/trunk/Tupfile.lua b/programs/games/FindNumbers/trunk/Tupfile.lua new file mode 100644 index 0000000000..941f5b51e0 --- /dev/null +++ b/programs/games/FindNumbers/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_CMM") ~= "" then return end +tup.rule("FindNumbers.c--", "c-- %f" .. tup.getconfig("KPACK_CMD"), "FindNumbers") diff --git a/programs/games/MSquare/trunk/Tupfile.lua b/programs/games/MSquare/trunk/Tupfile.lua new file mode 100644 index 0000000000..77779198ee --- /dev/null +++ b/programs/games/MSquare/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"MSquare.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "MSquare") diff --git a/programs/games/arcanii/trunk/Tupfile.lua b/programs/games/arcanii/trunk/Tupfile.lua new file mode 100644 index 0000000000..fde91e04ad --- /dev/null +++ b/programs/games/arcanii/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"arcanii.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "arcanii") diff --git a/programs/games/arcanoid/trunk/Tupfile.lua b/programs/games/arcanoid/trunk/Tupfile.lua new file mode 100644 index 0000000000..d176087e21 --- /dev/null +++ b/programs/games/arcanoid/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"arcanoid.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "arcanoid") diff --git a/programs/games/arcanoid/trunk/ARC.BMP b/programs/games/arcanoid/trunk/arc.bmp similarity index 100% rename from programs/games/arcanoid/trunk/ARC.BMP rename to programs/games/arcanoid/trunk/arc.bmp diff --git a/programs/games/bnc/trunk/Tupfile.lua b/programs/games/bnc/trunk/Tupfile.lua new file mode 100644 index 0000000000..ea2d3cb7fd --- /dev/null +++ b/programs/games/bnc/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"bnc.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "bnc") diff --git a/programs/games/bomber/Tupfile.lua b/programs/games/bomber/Tupfile.lua new file mode 100644 index 0000000000..b0a45ddde0 --- /dev/null +++ b/programs/games/bomber/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"bomber.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "bomber") diff --git a/programs/games/bomber/sounds/Tupfile.lua b/programs/games/bomber/sounds/Tupfile.lua new file mode 100644 index 0000000000..480522f8f0 --- /dev/null +++ b/programs/games/bomber/sounds/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("bomberdata.asm", "fasm %f %o", "bomberdata.bin") diff --git a/programs/games/c4/trunk/Tupfile.lua b/programs/games/c4/trunk/Tupfile.lua new file mode 100644 index 0000000000..f48102743f --- /dev/null +++ b/programs/games/c4/trunk/Tupfile.lua @@ -0,0 +1,7 @@ +if tup.getconfig("NO_NASM") ~= "" then return end +-- tup.rule is too unmannerly to %define +tup.definerule{ + command = "echo %%define lang '" .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. "'> lang_nasm.inc", + outputs = {"lang_nasm.inc"} +} +tup.rule({"c4.asm", extra_inputs = {"lang_nasm.inc"}}, "nasm -f bin -o %o %f " .. tup.getconfig("KPACK_CMD"), "c4") diff --git a/programs/games/clicks/trunk/Tupfile.lua b/programs/games/clicks/trunk/Tupfile.lua new file mode 100644 index 0000000000..8e2ce8c293 --- /dev/null +++ b/programs/games/clicks/trunk/Tupfile.lua @@ -0,0 +1,6 @@ +if tup.getconfig("NO_CMM") ~= "" then return end +if tup.getconfig("LANG") == "ru" +then C_LANG = "LANG_RUS" +else C_LANG = "LANG_ENG" -- this includes default case without config +end +tup.rule("clicks.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "clicks.com") diff --git a/programs/games/console15/Tupfile.lua b/programs/games/console15/Tupfile.lua new file mode 100644 index 0000000000..ebfa51e97e --- /dev/null +++ b/programs/games/console15/Tupfile.lua @@ -0,0 +1,7 @@ +if tup.getconfig("NO_FASM") ~= "" or tup.getconfig("NO_GCC") ~= "" then return end +HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR") +tup.include(HELPERDIR .. "/use_gcc.lua") +LDFLAGS = LDFLAGS .. " -T kolibri.ld" +tup.append_table(OBJS, tup.rule("asm_code.asm", "fasm %f %o", "asm_code.o")) +compile_gcc{"c_code.c", "system/kolibri.c", "system/stdlib.c", "system/string.c"} +link_gcc("console15") diff --git a/programs/games/console15/kolibri.ld b/programs/games/console15/kolibri.ld index 23841f98db..5108410375 100644 --- a/programs/games/console15/kolibri.ld +++ b/programs/games/console15/kolibri.ld @@ -17,4 +17,8 @@ SECTIONS *(.bss) } Memory = . ; + /DISCARD/ : { + *(.comment) + *(.drectve) + } } diff --git a/programs/games/donkey/Tupfile.lua b/programs/games/donkey/Tupfile.lua new file mode 100644 index 0000000000..6b9b3138bd --- /dev/null +++ b/programs/games/donkey/Tupfile.lua @@ -0,0 +1,7 @@ +if tup.getconfig("NO_FASM") ~= "" or tup.getconfig("NO_GCC") ~= "" then return end +HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR") +tup.include(HELPERDIR .. "/use_gcc.lua") +LDFLAGS = LDFLAGS .. " -T kolibri.ld" +tup.append_table(OBJS, tup.rule("asm_code.asm", "fasm %f %o", "asm_code.o")) +compile_gcc{"c_code.c", "system/kolibri.c", "system/stdlib.c", "system/string.c", "system/gblib.c"} +link_gcc("donkey") diff --git a/programs/games/donkey/kolibri.ld b/programs/games/donkey/kolibri.ld index 23841f98db..5108410375 100644 --- a/programs/games/donkey/kolibri.ld +++ b/programs/games/donkey/kolibri.ld @@ -17,4 +17,8 @@ SECTIONS *(.bss) } Memory = . ; + /DISCARD/ : { + *(.comment) + *(.drectve) + } } diff --git a/programs/games/eliza/Tupfile.lua b/programs/games/eliza/Tupfile.lua new file mode 100644 index 0000000000..afae4d05b3 --- /dev/null +++ b/programs/games/eliza/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("eliza.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "eliza") diff --git a/programs/games/fara/trunk/Tupfile.lua b/programs/games/fara/trunk/Tupfile.lua new file mode 100644 index 0000000000..aa977800ab --- /dev/null +++ b/programs/games/fara/trunk/Tupfile.lua @@ -0,0 +1,9 @@ +if tup.getconfig("NO_FASM") ~= "" or tup.getconfig("NO_MSVC") ~= "" then return end +HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../.." or tup.getconfig("HELPERDIR") +tup.include(HELPERDIR .. "/use_msvc.lua") +tup.append_table(OBJS, + tup.foreach_rule("memcmp.asm", "fasm %f %o", "%B.obj") +) +table.insert(OBJS, "lzma_unpack.obj") -- ??? it doesn't work after fasm recompilation +compile_msvc{"*.cpp"} +link_msvc("fara") diff --git a/programs/games/fara/trunk/memcmp.asm b/programs/games/fara/trunk/memcmp.asm new file mode 100644 index 0000000000..b4fc2bed57 --- /dev/null +++ b/programs/games/fara/trunk/memcmp.asm @@ -0,0 +1,15 @@ +format MS COFF +section '.text' code readable executable +public _memcmp +_memcmp: + push esi edi + mov esi, [esp+12] + mov edi, [esp+16] + mov ecx, [esp+20] + repz cmpsb + pop edi esi + setb ah + seta al + sub al, ah + movsx eax, al + ret diff --git a/programs/games/fara/trunk/top10wnd.cpp b/programs/games/fara/trunk/top10wnd.cpp index 823c72ee97..2582f8904e 100644 --- a/programs/games/fara/trunk/top10wnd.cpp +++ b/programs/games/fara/trunk/top10wnd.cpp @@ -166,7 +166,7 @@ int enterCharNdx = 0; // -void ReleaseTop10() +void __cdecl ReleaseTop10() { // if ( top10Heroes != NULL ) diff --git a/programs/games/flood-it/trunk/Tupfile.lua b/programs/games/flood-it/trunk/Tupfile.lua new file mode 100644 index 0000000000..c2db01b6b5 --- /dev/null +++ b/programs/games/flood-it/trunk/Tupfile.lua @@ -0,0 +1,6 @@ +if tup.getconfig("NO_CMM") ~= "" then return end +if tup.getconfig("LANG") == "ru" +then C_LANG = "LANG_RUS" +else C_LANG = "LANG_ENG" -- this includes default case without config +end +tup.rule("flood-it.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "flood-it.com") diff --git a/programs/games/foxhunt/Tupfile.lua b/programs/games/foxhunt/Tupfile.lua new file mode 100644 index 0000000000..9404d6d5c2 --- /dev/null +++ b/programs/games/foxhunt/Tupfile.lua @@ -0,0 +1,7 @@ +if tup.getconfig("NO_FASM") ~= "" or tup.getconfig("NO_GCC") ~= "" then return end +HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR") +tup.include(HELPERDIR .. "/use_gcc.lua") +LDFLAGS = LDFLAGS .. " -T kolibri.ld" +tup.append_table(OBJS, tup.rule("start.asm", "fasm %f %o", "start.o")) +compile_gcc{"foxhunt.c", "system/kolibri.c", "system/stdlib.c", "system/string.c", "system/ctype.c"} +link_gcc("foxhunt") diff --git a/programs/games/foxhunt/kolibri.ld b/programs/games/foxhunt/kolibri.ld index 23841f98db..5108410375 100644 --- a/programs/games/foxhunt/kolibri.ld +++ b/programs/games/foxhunt/kolibri.ld @@ -17,4 +17,8 @@ SECTIONS *(.bss) } Memory = . ; + /DISCARD/ : { + *(.comment) + *(.drectve) + } } diff --git a/programs/games/freecell/Tupfile.lua b/programs/games/freecell/Tupfile.lua new file mode 100644 index 0000000000..44ac986be3 --- /dev/null +++ b/programs/games/freecell/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"freecell.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "freecell") diff --git a/programs/games/gomoku/trunk/Tupfile.lua b/programs/games/gomoku/trunk/Tupfile.lua new file mode 100644 index 0000000000..3a88d422c1 --- /dev/null +++ b/programs/games/gomoku/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"gomoku.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "gomoku") diff --git a/programs/games/hunter/trunk/Tupfile.lua b/programs/games/hunter/trunk/Tupfile.lua new file mode 100644 index 0000000000..7732ffc8d9 --- /dev/null +++ b/programs/games/hunter/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("hunter.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "hunter") diff --git a/programs/games/invaders/Tupfile.lua b/programs/games/invaders/Tupfile.lua new file mode 100644 index 0000000000..25ff54cad8 --- /dev/null +++ b/programs/games/invaders/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("invaders.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "invaders") diff --git a/programs/games/klavisha/trunk/Tupfile.lua b/programs/games/klavisha/trunk/Tupfile.lua new file mode 100644 index 0000000000..5fa7a868aa --- /dev/null +++ b/programs/games/klavisha/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"klavisha.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "klavisha") diff --git a/programs/games/kosilka/Tupfile.lua b/programs/games/kosilka/Tupfile.lua new file mode 100644 index 0000000000..a255897b6e --- /dev/null +++ b/programs/games/kosilka/Tupfile.lua @@ -0,0 +1,5 @@ +if tup.getconfig("NO_FASM") ~= "" or tup.getconfig("NO_MSVC") ~= "" then return end +HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR") +tup.include(HELPERDIR .. "/use_msvc.lua") +compile_msvc{"kosilka.cpp", "KosFile.cpp", "kosSyst.cpp", "mcsmemm.cpp"} +link_msvc("kosilka") diff --git a/programs/games/kox/trunk/Tupfile.lua b/programs/games/kox/trunk/Tupfile.lua new file mode 100644 index 0000000000..a168a9f8c4 --- /dev/null +++ b/programs/games/kox/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("kox.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "kox") diff --git a/programs/games/life3/trunk/Tupfile.lua b/programs/games/life3/trunk/Tupfile.lua new file mode 100644 index 0000000000..e329ca6237 --- /dev/null +++ b/programs/games/life3/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("life3.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "life3") diff --git a/programs/games/lights/trunk/Tupfile.lua b/programs/games/lights/trunk/Tupfile.lua new file mode 100644 index 0000000000..566648a95a --- /dev/null +++ b/programs/games/lights/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("lights.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "lights") diff --git a/programs/games/lines/Tupfile.lua b/programs/games/lines/Tupfile.lua new file mode 100644 index 0000000000..46290f6a74 --- /dev/null +++ b/programs/games/lines/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"lines.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "lines") diff --git a/programs/games/mario2/trunk/Tupfile.lua b/programs/games/mario2/trunk/Tupfile.lua new file mode 100644 index 0000000000..18f0bd5c44 --- /dev/null +++ b/programs/games/mario2/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("MARIO.ASM", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "MARIO") diff --git a/programs/games/mblocks/trunk/Tupfile.lua b/programs/games/mblocks/trunk/Tupfile.lua new file mode 100644 index 0000000000..c606337451 --- /dev/null +++ b/programs/games/mblocks/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("mblocks.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "mblocks") diff --git a/programs/games/mcities/Tupfile.lua b/programs/games/mcities/Tupfile.lua new file mode 100644 index 0000000000..bcba9c27e8 --- /dev/null +++ b/programs/games/mcities/Tupfile.lua @@ -0,0 +1,7 @@ +if tup.getconfig("NO_FASM") ~= "" or tup.getconfig("NO_GCC") ~= "" then return end +HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR") +tup.include(HELPERDIR .. "/use_gcc.lua") +LDFLAGS = LDFLAGS .. " -T kolibri.ld" +tup.append_table(OBJS, tup.rule("asm_code.asm", "fasm %f %o", "asm_code.o")) +compile_gcc{"mcities.c", "system/kolibri.c", "system/stdlib.c", "system/string.c", "system/ctype.c"} +link_gcc("mcities") diff --git a/programs/games/megamaze/trunk/Tupfile.lua b/programs/games/megamaze/trunk/Tupfile.lua new file mode 100644 index 0000000000..2ba9cd8691 --- /dev/null +++ b/programs/games/megamaze/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("megamaze.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "megamaze") diff --git a/programs/games/mine/trunk/Tupfile.lua b/programs/games/mine/trunk/Tupfile.lua new file mode 100644 index 0000000000..b06ffc12a2 --- /dev/null +++ b/programs/games/mine/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_CMM") ~= "" then return end +tup.rule("mine.c--", "c-- %f /meos" .. tup.getconfig("KPACK_CMD"), "mine") diff --git a/programs/games/nu_pogodi/trunk/Tupfile.lua b/programs/games/nu_pogodi/trunk/Tupfile.lua new file mode 100644 index 0000000000..4893e6f5c7 --- /dev/null +++ b/programs/games/nu_pogodi/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("nu_pogod.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "nu_pogod") diff --git a/programs/games/phenix/trunk/Tupfile.lua b/programs/games/phenix/trunk/Tupfile.lua new file mode 100644 index 0000000000..8b050cfdb5 --- /dev/null +++ b/programs/games/phenix/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"phenix.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "phenix") diff --git a/programs/games/pipes/Tupfile.lua b/programs/games/pipes/Tupfile.lua new file mode 100644 index 0000000000..f26c2dad65 --- /dev/null +++ b/programs/games/pipes/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"pipes.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "pipes") diff --git a/programs/games/piton/Tupfile.lua b/programs/games/piton/Tupfile.lua new file mode 100644 index 0000000000..f9d6690e10 --- /dev/null +++ b/programs/games/piton/Tupfile.lua @@ -0,0 +1,7 @@ +if tup.getconfig("NO_FASM") ~= "" or tup.getconfig("NO_GCC") ~= "" then return end +HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR") +tup.include(HELPERDIR .. "/use_gcc.lua") +LDFLAGS = LDFLAGS .. " -T kolibri.ld" +tup.append_table(OBJS, tup.rule("asm_code.asm", "fasm %f %o", "asm_code.o")) +compile_gcc{"c_code.c", "system/kolibri.c", "system/stdlib.c", "system/string.c", "system/gblib.c"} +link_gcc("piton") diff --git a/programs/games/pong/trunk/Tupfile.lua b/programs/games/pong/trunk/Tupfile.lua new file mode 100644 index 0000000000..64e2bd098a --- /dev/null +++ b/programs/games/pong/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"pong.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "pong") diff --git a/programs/games/pong3/trunk/Tupfile.lua b/programs/games/pong3/trunk/Tupfile.lua new file mode 100644 index 0000000000..2f5e1e553d --- /dev/null +++ b/programs/games/pong3/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("pong3.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "pong3") diff --git a/programs/games/reversi/trunk/Tupfile.lua b/programs/games/reversi/trunk/Tupfile.lua new file mode 100644 index 0000000000..a4c44a4a75 --- /dev/null +++ b/programs/games/reversi/trunk/Tupfile.lua @@ -0,0 +1,6 @@ +if tup.getconfig('NO_GCC') ~= "" then return end +HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../.." or tup.getconfig("HELPERDIR") +tup.include(HELPERDIR .. "/use_gcc.lua") +tup.include(HELPERDIR .. "/use_menuetlibc.lua") +compile_gcc{"reversi.c"} +link_gcc("reversi") diff --git a/programs/games/reversi/trunk/reversi.c b/programs/games/reversi/trunk/reversi.c index 08ef3e2eda..b33debdb7a 100644 --- a/programs/games/reversi/trunk/reversi.c +++ b/programs/games/reversi/trunk/reversi.c @@ -645,3 +645,6 @@ void main(void) } } +/* We use LIBC only for strcpy/itoa, so we don't need CRT startup code */ +int __bss_count; +void __crt1_startup() { main(); } diff --git a/programs/games/rforces/trunk/Tupfile.lua b/programs/games/rforces/trunk/Tupfile.lua new file mode 100644 index 0000000000..027eb878c8 --- /dev/null +++ b/programs/games/rforces/trunk/Tupfile.lua @@ -0,0 +1,5 @@ +if tup.getconfig("NO_FASM") ~= "" or tup.getconfig("NO_MSVC") ~= "" then return end +HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../.." or tup.getconfig("HELPERDIR") +tup.include(HELPERDIR .. "/use_msvc.lua") +compile_msvc{"forces_1.1.cpp", "kosFile.cpp", "kosSyst.cpp", "mcsmemm.cpp"} +link_msvc("rforces") diff --git a/programs/games/rsquare/trunk/Tupfile.lua b/programs/games/rsquare/trunk/Tupfile.lua new file mode 100644 index 0000000000..55f19191dc --- /dev/null +++ b/programs/games/rsquare/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"rsquare.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "rsquare") diff --git a/programs/games/snake/trunk/Tupfile.lua b/programs/games/snake/trunk/Tupfile.lua new file mode 100644 index 0000000000..cf4eba9d50 --- /dev/null +++ b/programs/games/snake/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("snake.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "snake") diff --git a/programs/games/soko/trunk/Tupfile.lua b/programs/games/soko/trunk/Tupfile.lua new file mode 100644 index 0000000000..7d08cdb4db --- /dev/null +++ b/programs/games/soko/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"SOKO.ASM", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "SOKO") diff --git a/programs/games/sq_game/trunk/Tupfile.lua b/programs/games/sq_game/trunk/Tupfile.lua new file mode 100644 index 0000000000..d507398b4a --- /dev/null +++ b/programs/games/sq_game/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"SQ_GAME.ASM", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "SQ_GAME") diff --git a/programs/games/sudoku/trunk/Tupfile.lua b/programs/games/sudoku/trunk/Tupfile.lua new file mode 100644 index 0000000000..0503b8e84f --- /dev/null +++ b/programs/games/sudoku/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"sudoku.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "sudoku") diff --git a/programs/games/sw/trunk/Tupfile.lua b/programs/games/sw/trunk/Tupfile.lua new file mode 100644 index 0000000000..33a4bb3ecc --- /dev/null +++ b/programs/games/sw/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"sw.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "sw") diff --git a/programs/games/tanks/trunk/Tupfile.lua b/programs/games/tanks/trunk/Tupfile.lua new file mode 100644 index 0000000000..f545f97b81 --- /dev/null +++ b/programs/games/tanks/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"tanks.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "tanks") diff --git a/programs/games/tetris/trunk/Tupfile.lua b/programs/games/tetris/trunk/Tupfile.lua new file mode 100644 index 0000000000..aa133e14c3 --- /dev/null +++ b/programs/games/tetris/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"tetris.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "tetris") diff --git a/programs/games/xonix/trunk/Tupfile.lua b/programs/games/xonix/trunk/Tupfile.lua new file mode 100644 index 0000000000..3bf576ada4 --- /dev/null +++ b/programs/games/xonix/trunk/Tupfile.lua @@ -0,0 +1,5 @@ +if tup.getconfig("NO_MSVC") ~= "" then return end +HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../.." or tup.getconfig("HELPERDIR") +tup.include(HELPERDIR .. "/use_msvc.lua") +compile_msvc{"*.cpp"} +link_msvc("xonix") diff --git a/programs/games/xonix/trunk/main.cpp b/programs/games/xonix/trunk/main.cpp index 32f76bb106..b354d065a9 100644 --- a/programs/games/xonix/trunk/main.cpp +++ b/programs/games/xonix/trunk/main.cpp @@ -1480,7 +1480,7 @@ void SetEntryVars() // -void ReleaseTop10() +void __cdecl ReleaseTop10() { // if ( top10Heroes != NULL ) diff --git a/programs/hd_load/meosload/Tupfile.lua b/programs/hd_load/meosload/Tupfile.lua new file mode 100644 index 0000000000..10af3b3fa2 --- /dev/null +++ b/programs/hd_load/meosload/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("MeOSload.asm", "fasm %f %o", "MeOSload.com") diff --git a/programs/hd_load/mtldr/Tupfile.lua b/programs/hd_load/mtldr/Tupfile.lua new file mode 100644 index 0000000000..a4ca797228 --- /dev/null +++ b/programs/hd_load/mtldr/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("mtldr.asm", "fasm %f %o", "mtldr") diff --git a/programs/hd_load/mtldr_install/Tupfile.lua b/programs/hd_load/mtldr_install/Tupfile.lua new file mode 100644 index 0000000000..5ab661f616 --- /dev/null +++ b/programs/hd_load/mtldr_install/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("mtldr_code/mtldr.asm", "fasm %f %o", "mtldr_for_installer") +tup.rule({"mtldr_install.asm", extra_inputs = {"mtldr_for_installer"}}, "fasm %f %o", "mtldr_install.exe") diff --git a/programs/hd_load/usb_boot/Tupfile.lua b/programs/hd_load/usb_boot/Tupfile.lua new file mode 100644 index 0000000000..88c7bb0038 --- /dev/null +++ b/programs/hd_load/usb_boot/Tupfile.lua @@ -0,0 +1,5 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("setmbr.asm", "fasm %f %o", "setmbr.exe") +tup.rule("inst.asm", "fasm %f %o", "inst.exe") +tup.rule("BOOT_F32.ASM", "fasm %f %o", "BOOT_F32.BIN") +tup.rule("mtldr.asm", "fasm %f %o", "MTLD_F32") diff --git a/programs/hd_load/usb_boot_old/Tupfile.lua b/programs/hd_load/usb_boot_old/Tupfile.lua new file mode 100644 index 0000000000..c6f9105362 --- /dev/null +++ b/programs/hd_load/usb_boot_old/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("MeOSload.asm", "fasm %f %o", "MeOSload.com") +tup.rule("enable.asm", "fasm %f %o", "enable.exe") diff --git a/programs/media/ac97snd/Tupfile.lua b/programs/media/ac97snd/Tupfile.lua new file mode 100644 index 0000000000..573965b35d --- /dev/null +++ b/programs/media/ac97snd/Tupfile.lua @@ -0,0 +1,9 @@ +if tup.getconfig("NO_FASM") ~= "" or tup.getconfig("NO_MSVC") ~= "" then return end +HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR") +tup.include(HELPERDIR .. "/use_msvc.lua") + +compile_msvc{"ac97snd/ac97wav.c", "ac97snd/crt.c"} +OBJS += tup.foreach_rule({"ac97snd/k_lib.asm", "ufmod-config.asm"}, "fasm %f %o", "%B.obj") +OBJS += "mpg/mpg.lib" +OBJS += "../../develop/sdk/trunk/sound/src/sound.lib" +link_msvc("ac97snd.bin") diff --git a/programs/media/ac97snd/mpg/Tupfile.lua b/programs/media/ac97snd/mpg/Tupfile.lua new file mode 100644 index 0000000000..e85ca0f346 --- /dev/null +++ b/programs/media/ac97snd/mpg/Tupfile.lua @@ -0,0 +1,6 @@ +if tup.getconfig("NO_FASM") ~= "" or tup.getconfig("NO_MSVC") ~= "" then return end +HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../.." or tup.getconfig("HELPERDIR") +tup.include(HELPERDIR .. "/use_msvc.lua") +compile_msvc{"*.c"} +tup.append_table(OBJS, tup.rule("pow.asm", "fasm %f %o", "pow.obj")) +tup.rule(OBJS, "link.exe /lib /out:%o %f", "mpg.lib") diff --git a/programs/media/animage/trunk/Tupfile.lua b/programs/media/animage/trunk/Tupfile.lua new file mode 100644 index 0000000000..f5bd54527a --- /dev/null +++ b/programs/media/animage/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("animage.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "animage") diff --git a/programs/media/cdp/trunk/Tupfile.lua b/programs/media/cdp/trunk/Tupfile.lua new file mode 100644 index 0000000000..9dc6ff2dbe --- /dev/null +++ b/programs/media/cdp/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"cdp.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "cdp") diff --git a/programs/media/iconedit/trunk/Tupfile.lua b/programs/media/iconedit/trunk/Tupfile.lua new file mode 100644 index 0000000000..b47f148961 --- /dev/null +++ b/programs/media/iconedit/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"iconedit.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "iconedit") diff --git a/programs/media/infinity_mixer/Tupfile.lua b/programs/media/infinity_mixer/Tupfile.lua new file mode 100644 index 0000000000..697c386cbf --- /dev/null +++ b/programs/media/infinity_mixer/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("infinity_mixer.ASM", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "infinity_mixer") diff --git a/programs/media/infinity_mixer/infinity_mixer.ASM b/programs/media/infinity_mixer/infinity_mixer.ASM index 6e8f6134e0..f952aa55f9 100644 --- a/programs/media/infinity_mixer/infinity_mixer.ASM +++ b/programs/media/infinity_mixer/infinity_mixer.ASM @@ -18,7 +18,7 @@ use32 dd I_MEM ; stack heap dd 0x0, 0x0 -include 'aspAPI.inc' +include 'aspapi.INC' include '../../macros.inc' ;include 'string.inc' diff --git a/programs/media/kiv/trunk/Tupfile.lua b/programs/media/kiv/trunk/Tupfile.lua new file mode 100644 index 0000000000..6ed515414d --- /dev/null +++ b/programs/media/kiv/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("kiv.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "kiv") diff --git a/programs/media/listplay/trunk/Tupfile.lua b/programs/media/listplay/trunk/Tupfile.lua new file mode 100644 index 0000000000..1481752d49 --- /dev/null +++ b/programs/media/listplay/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("listplay.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "listplay") diff --git a/programs/media/log_el/trunk/Tupfile.lua b/programs/media/log_el/trunk/Tupfile.lua new file mode 100644 index 0000000000..97341ee3c4 --- /dev/null +++ b/programs/media/log_el/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("log_el.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "log_el") diff --git a/programs/media/midamp/trunk/Tupfile.lua b/programs/media/midamp/trunk/Tupfile.lua new file mode 100644 index 0000000000..f7e3678a1c --- /dev/null +++ b/programs/media/midamp/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"midamp.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "midamp") diff --git a/programs/media/midamp/trunk/build.bat b/programs/media/midamp/trunk/build.bat index 6de95dcad0..ebc2668562 100644 --- a/programs/media/midamp/trunk/build.bat +++ b/programs/media/midamp/trunk/build.bat @@ -1,3 +1,4 @@ +@echo lang fix en > lang.inc @fasm midamp.asm midamp @kpack midamp @pause \ No newline at end of file diff --git a/programs/media/midamp/trunk/midamp.asm b/programs/media/midamp/trunk/midamp.asm index 721d3a31e6..5a5d853675 100644 --- a/programs/media/midamp/trunk/midamp.asm +++ b/programs/media/midamp/trunk/midamp.asm @@ -73,7 +73,7 @@ include '../../../develop/libraries/box_lib/load_lib.mac' @use_library -lang fix en +include 'lang.inc' ;purge mov include '../../../debug.inc' ;include 'dlg.inc' diff --git a/programs/media/midiplay/trunk/Tupfile.lua b/programs/media/midiplay/trunk/Tupfile.lua new file mode 100644 index 0000000000..4e52b584ec --- /dev/null +++ b/programs/media/midiplay/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"midiplay.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "midiplay") diff --git a/programs/media/mixer/trunk/Tupfile.lua b/programs/media/mixer/trunk/Tupfile.lua new file mode 100644 index 0000000000..0c5966ed8c --- /dev/null +++ b/programs/media/mixer/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"mixer.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "mixer") diff --git a/programs/media/mv/trunk/Tupfile.lua b/programs/media/mv/trunk/Tupfile.lua new file mode 100644 index 0000000000..0689f3bbad --- /dev/null +++ b/programs/media/mv/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"mv.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "mv") diff --git a/programs/media/palitra/trunk/Tupfile.lua b/programs/media/palitra/trunk/Tupfile.lua new file mode 100644 index 0000000000..e0753f6c5e --- /dev/null +++ b/programs/media/palitra/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("palitra.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "palitra") diff --git a/programs/media/pic4/trunk/Tupfile.lua b/programs/media/pic4/trunk/Tupfile.lua new file mode 100644 index 0000000000..1225dc306d --- /dev/null +++ b/programs/media/pic4/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"pic4.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "pic4") diff --git a/programs/media/sb/trunk/Tupfile.lua b/programs/media/sb/trunk/Tupfile.lua new file mode 100644 index 0000000000..c21df1ed57 --- /dev/null +++ b/programs/media/sb/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"sb.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "sb") diff --git a/programs/media/scrshoot/Tupfile.lua b/programs/media/scrshoot/Tupfile.lua new file mode 100644 index 0000000000..21ec4fe090 --- /dev/null +++ b/programs/media/scrshoot/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"scrshoot.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "scrshoot") diff --git a/programs/media/scrv/Tupfile.lua b/programs/media/scrv/Tupfile.lua new file mode 100644 index 0000000000..ef8e4e0316 --- /dev/null +++ b/programs/media/scrv/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("scrv.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "scrv") diff --git a/programs/media/startmus/trunk/Tupfile.lua b/programs/media/startmus/trunk/Tupfile.lua new file mode 100644 index 0000000000..1d885a6462 --- /dev/null +++ b/programs/media/startmus/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("STARTMUS.ASM", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "STARTMUS") diff --git a/programs/media/voxel_editor/trunk/Tupfile.lua b/programs/media/voxel_editor/trunk/Tupfile.lua new file mode 100644 index 0000000000..f6315ac792 --- /dev/null +++ b/programs/media/voxel_editor/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("voxel_editor.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "voxel_editor") diff --git a/programs/media/voxel_editor/utilites/Tupfile.lua b/programs/media/voxel_editor/utilites/Tupfile.lua new file mode 100644 index 0000000000..78a2297fb4 --- /dev/null +++ b/programs/media/voxel_editor/utilites/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.foreach_rule({"vox_creator.asm", "vox_mover.asm"}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "%B") diff --git a/programs/media/zsea/Tupfile.lua b/programs/media/zsea/Tupfile.lua new file mode 100644 index 0000000000..4fe7315bb8 --- /dev/null +++ b/programs/media/zsea/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"zSea.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "zSea") diff --git a/programs/media/zsea/plugins/bmp/Tupfile.lua b/programs/media/zsea/plugins/bmp/Tupfile.lua new file mode 100644 index 0000000000..66377337d2 --- /dev/null +++ b/programs/media/zsea/plugins/bmp/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("cnv_bmp.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "cnv_bmp.obj") diff --git a/programs/media/zsea/plugins/convert/Tupfile.lua b/programs/media/zsea/plugins/convert/Tupfile.lua new file mode 100644 index 0000000000..d8291a51cb --- /dev/null +++ b/programs/media/zsea/plugins/convert/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("convert.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "convert.obj") diff --git a/programs/media/zsea/plugins/gif/Tupfile.lua b/programs/media/zsea/plugins/gif/Tupfile.lua new file mode 100644 index 0000000000..1310b5c889 --- /dev/null +++ b/programs/media/zsea/plugins/gif/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("cnv_gif.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "cnv_gif.obj") diff --git a/programs/media/zsea/plugins/jpeg/Tupfile.lua b/programs/media/zsea/plugins/jpeg/Tupfile.lua new file mode 100644 index 0000000000..2fff4e790c --- /dev/null +++ b/programs/media/zsea/plugins/jpeg/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("cnv_jpeg.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "cnv_jpeg.obj") diff --git a/programs/media/zsea/plugins/png/Tupfile.lua b/programs/media/zsea/plugins/png/Tupfile.lua new file mode 100644 index 0000000000..22afa3145b --- /dev/null +++ b/programs/media/zsea/plugins/png/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("cnv_png.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "cnv_png.obj") diff --git a/programs/media/zsea/plugins/rotate/Tupfile.lua b/programs/media/zsea/plugins/rotate/Tupfile.lua new file mode 100644 index 0000000000..d3a878c77b --- /dev/null +++ b/programs/media/zsea/plugins/rotate/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("rotate.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "rotate.obj") diff --git a/programs/media/zsea/plugins/scaling/Tupfile.lua b/programs/media/zsea/plugins/scaling/Tupfile.lua new file mode 100644 index 0000000000..c491a64101 --- /dev/null +++ b/programs/media/zsea/plugins/scaling/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("scaling.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "scaling.obj") diff --git a/programs/network/downloader/Tupfile.lua b/programs/network/downloader/Tupfile.lua new file mode 100644 index 0000000000..d39d1bb5f1 --- /dev/null +++ b/programs/network/downloader/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("downloader.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "downloader") diff --git a/programs/network/ftpc/Tupfile.lua b/programs/network/ftpc/Tupfile.lua new file mode 100644 index 0000000000..f48e0109d6 --- /dev/null +++ b/programs/network/ftpc/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("ftpc.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "ftpc") diff --git a/programs/network/ftpd/Tupfile.lua b/programs/network/ftpd/Tupfile.lua new file mode 100644 index 0000000000..0f9c16aba1 --- /dev/null +++ b/programs/network/ftpd/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("ftpd.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "ftpd") diff --git a/programs/network/icmp/Tupfile.lua b/programs/network/icmp/Tupfile.lua new file mode 100644 index 0000000000..052f5b3bee --- /dev/null +++ b/programs/network/icmp/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("ping.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "ping") diff --git a/programs/network/ircc/Tupfile.lua b/programs/network/ircc/Tupfile.lua new file mode 100644 index 0000000000..33b6063165 --- /dev/null +++ b/programs/network/ircc/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("ircc.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "ircc") diff --git a/programs/network/netcfg/Tupfile.lua b/programs/network/netcfg/Tupfile.lua new file mode 100644 index 0000000000..35daff68f7 --- /dev/null +++ b/programs/network/netcfg/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("netcfg.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "netcfg") diff --git a/programs/network/netstat/Tupfile.lua b/programs/network/netstat/Tupfile.lua new file mode 100644 index 0000000000..634033440a --- /dev/null +++ b/programs/network/netstat/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("netstat.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "netstat") diff --git a/programs/network/nslookup/Tupfile.lua b/programs/network/nslookup/Tupfile.lua new file mode 100644 index 0000000000..031b2acf94 --- /dev/null +++ b/programs/network/nslookup/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("nslookup.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "nslookup") diff --git a/programs/network/pasta/Tupfile.lua b/programs/network/pasta/Tupfile.lua new file mode 100644 index 0000000000..2b1df30ac8 --- /dev/null +++ b/programs/network/pasta/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("pasta.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "pasta") diff --git a/programs/network/pppoe/Tupfile.lua b/programs/network/pppoe/Tupfile.lua new file mode 100644 index 0000000000..8bfb2c0f9c --- /dev/null +++ b/programs/network/pppoe/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("pppoe.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "pppoe") diff --git a/programs/network/socketdbg/Tupfile.lua b/programs/network/socketdbg/Tupfile.lua new file mode 100644 index 0000000000..93089366bf --- /dev/null +++ b/programs/network/socketdbg/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("socketdbg.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "socketdbg") diff --git a/programs/network/synergyc/Tupfile.lua b/programs/network/synergyc/Tupfile.lua new file mode 100644 index 0000000000..57db8c516a --- /dev/null +++ b/programs/network/synergyc/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("synergyc.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "synergyc") diff --git a/programs/network/tcpserv/Tupfile.lua b/programs/network/tcpserv/Tupfile.lua new file mode 100644 index 0000000000..91e45f061a --- /dev/null +++ b/programs/network/tcpserv/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("tcpserv.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "tcpserv") diff --git a/programs/network/telnet/Tupfile.lua b/programs/network/telnet/Tupfile.lua new file mode 100644 index 0000000000..1a0950cef9 --- /dev/null +++ b/programs/network/telnet/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("telnet.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "telnet") diff --git a/programs/network/tftpc/Tupfile.lua b/programs/network/tftpc/Tupfile.lua new file mode 100644 index 0000000000..ce1d350909 --- /dev/null +++ b/programs/network/tftpc/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("tftpc.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "tftpc") diff --git a/programs/network/vncc/Tupfile.lua b/programs/network/vncc/Tupfile.lua new file mode 100644 index 0000000000..6c135cea24 --- /dev/null +++ b/programs/network/vncc/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("vncc.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "vncc") diff --git a/programs/network/zeroconf/Tupfile.lua b/programs/network/zeroconf/Tupfile.lua new file mode 100644 index 0000000000..0ff43a6888 --- /dev/null +++ b/programs/network/zeroconf/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("zeroconf.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "zeroconf") diff --git a/programs/other/RDInfo/Tupfile.lua b/programs/other/RDInfo/Tupfile.lua new file mode 100644 index 0000000000..24646e311f --- /dev/null +++ b/programs/other/RDInfo/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_NASM") ~= "" then return end +tup.rule("RDInfo.asm", "nasm -f bin -o %o %f " .. tup.getconfig("KPACK_CMD"), "RDInfo") diff --git a/programs/other/Timer/Tupfile.lua b/programs/other/Timer/Tupfile.lua new file mode 100644 index 0000000000..b83b07ba2a --- /dev/null +++ b/programs/other/Timer/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_NASM") ~= "" then return end +tup.rule("Timer.asm", "nasm -f bin -o %o %f " .. tup.getconfig("KPACK_CMD"), "timer") diff --git a/programs/other/calc/trunk/Tupfile.lua b/programs/other/calc/trunk/Tupfile.lua new file mode 100644 index 0000000000..058e17896e --- /dev/null +++ b/programs/other/calc/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("calc.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "calc") diff --git a/programs/other/calcplus/Tupfile.lua b/programs/other/calcplus/Tupfile.lua new file mode 100644 index 0000000000..e6cab4f15a --- /dev/null +++ b/programs/other/calcplus/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("calcplus.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "calcplus") diff --git a/programs/other/dictionary/Tupfile.lua b/programs/other/dictionary/Tupfile.lua new file mode 100644 index 0000000000..0660d61314 --- /dev/null +++ b/programs/other/dictionary/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("dictionary.ASM", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "dictionary") diff --git a/programs/other/dictionary/dictionary.ASM b/programs/other/dictionary/dictionary.ASM index 897180104b..12d07bd325 100644 --- a/programs/other/dictionary/dictionary.ASM +++ b/programs/other/dictionary/dictionary.ASM @@ -13,7 +13,7 @@ use32 ; include "../../macros.inc" include "../../proc32.inc" -include "API.inc" +include "API.INC" include "../../dll.inc" include '../../develop/libraries/box_lib/trunk/box_lib.mac' include '../../develop/libraries/box_lib/load_lib.mac' diff --git a/programs/other/fft/Tupfile.lua b/programs/other/fft/Tupfile.lua new file mode 100644 index 0000000000..7ca945e4da --- /dev/null +++ b/programs/other/fft/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("FHT4A.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "FHT4A") diff --git a/programs/other/font_conv/Tupfile.lua b/programs/other/font_conv/Tupfile.lua new file mode 100644 index 0000000000..b04038698a --- /dev/null +++ b/programs/other/font_conv/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("fontconv.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "fontconv") diff --git a/programs/other/ft232cc/Tupfile.lua b/programs/other/ft232cc/Tupfile.lua new file mode 100644 index 0000000000..44c2793a52 --- /dev/null +++ b/programs/other/ft232cc/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("ft232cc.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "ft232cc") diff --git a/programs/other/graph/Tupfile.lua b/programs/other/graph/Tupfile.lua new file mode 100644 index 0000000000..a1fb613f5f --- /dev/null +++ b/programs/other/graph/Tupfile.lua @@ -0,0 +1,8 @@ +if tup.getconfig("NO_FASM") ~= "" or tup.getconfig("NO_MSVC") ~= "" then return end +HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR") +tup.include(HELPERDIR .. "/use_msvc.lua") +tup.append_table(OBJS, + tup.foreach_rule("*.asm", "fasm %f %o", "%B.obj") +) +compile_msvc{"*.cpp"} +link_msvc("graph") diff --git a/programs/other/graph/math2.cpp b/programs/other/graph/math2.cpp index f31a5b75a1..dead28c58f 100644 --- a/programs/other/graph/math2.cpp +++ b/programs/other/graph/math2.cpp @@ -43,6 +43,7 @@ extern "C" double _ftol(double x) } } #endif +#pragma function(ceil) double __cdecl ceil(double x) { __asm { diff --git a/programs/other/graph/stdafx.cpp b/programs/other/graph/stdafx.cpp deleted file mode 100644 index eec82ebe13..0000000000 --- a/programs/other/graph/stdafx.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// FixedPoint.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -// TODO: reference any additional headers you need in STDAFX.H -// and not in this file diff --git a/programs/other/kpack/kerpack_linux/Makefile b/programs/other/kpack/kerpack_linux/Makefile new file mode 100644 index 0000000000..2adef93b8c --- /dev/null +++ b/programs/other/kpack/kerpack_linux/Makefile @@ -0,0 +1,21 @@ +CFLAGS=-O3 +all: kpack kerpack +kpack: kpack64.o LZMAEncoder-kpack.o MatchFinder.o RangeCoder.o + gcc -nostartfiles -o kpack kpack64.o LZMAEncoder-kpack.o MatchFinder.o RangeCoder.o +kpack64.o: kpack64.asm + fasm kpack64.asm kpack64.o +kerpack: kerpack64.o LZMAEncoder-kerpack.o MatchFinder.o RangeCoder.o + gcc -nostartfiles -o kerpack kerpack64.o LZMAEncoder-kerpack.o MatchFinder.o RangeCoder.o +kerpack64.o: kerpack64.asm + fasm kerpack64.asm kerpack64.o +LZMAEncoder-kpack.o: lzma_c/LZMAEncoder.c lzma_c/LZMAEncoder.h lzma_c/MatchFinder.h lzma_c/lzma.h lzma_c/RangeCoder.h lzma_c/RangeCoderBit.h lzma_c/RangeCoderBitTree.h lzma_c/common.h + gcc -c $(CFLAGS) -o LZMAEncoder-kpack.o lzma_c/LZMAEncoder.c +LZMAEncoder-kerpack.o: lzma_c/LZMAEncoder.c lzma_c/LZMAEncoder.h lzma_c/MatchFinder.h lzma_c/lzma.h lzma_c/RangeCoder.h lzma_c/RangeCoderBit.h lzma_c/RangeCoderBitTree.h lzma_c/common.h + gcc -c -DFOR_KERPACK $(CFLAGS) -o LZMAEncoder-kerpack.o lzma_c/LZMAEncoder.c +MatchFinder.o: lzma_c/MatchFinder.c lzma_c/MatchFinder.h lzma_c/common.h + gcc -c $(CFLAGS) -o MatchFinder.o lzma_c/MatchFinder.c +RangeCoder.o: lzma_c/RangeCoder.c lzma_c/RangeCoder.h lzma_c/RangeCoderBit.h lzma_c/RangeCoderBitTree.h lzma_c/lzma.h lzma_c/common.h + gcc -c $(CFLAGS) -o RangeCoder.o lzma_c/RangeCoder.c + +clean: + rm *.o kpack kerpack diff --git a/programs/other/kpack/kerpack_linux/calltrick2.asm b/programs/other/kpack/kerpack_linux/calltrick2.asm new file mode 100644 index 0000000000..36b04430ca --- /dev/null +++ b/programs/other/kpack/kerpack_linux/calltrick2.asm @@ -0,0 +1,32 @@ + pop esi + push esi +loader_patch4: + mov ecx, 0 ; will be patched: number of calltrick entries +ctrloop: + lodsb +@@: + cmp al, 0xF + jnz .f + lodsb + cmp al, 80h + jb @b + cmp al, 90h + jb @f +.f: + sub al, 0E8h + cmp al, 1 + ja ctrloop +@@: + cmp byte [esi], 0 ; will be patched: code in calltrick entries +loader_patch5: + jnz ctrloop + lodsd +; "bswap eax" is not supported on i386 +; mov al,0/bswap eax = 4 bytes, following instructions = 9 bytes + shr ax, 8 + ror eax, 16 + xchg al, ah + sub eax, esi + add eax, [esp] + mov [esi-4], eax + loop ctrloop diff --git a/programs/other/kpack/kerpack_linux/kerpack64.asm b/programs/other/kpack/kerpack_linux/kerpack64.asm new file mode 100644 index 0000000000..a6d88a2d9f --- /dev/null +++ b/programs/other/kpack/kerpack_linux/kerpack64.asm @@ -0,0 +1,460 @@ +;freebsd = 1 ;uncomment for FreeBSD-specific changes + + format ELF64 + public _start +.data? fix section ".bss" writeable align 4 +.data fix section ".data" writeable align 4 +.const fix section ".const" align 4 +.code fix section ".text" executable align 16 +offset fix +ptr fix +struc label type { + label . type } + +extrn lzma_compress +extrn lzma_set_dict_size + +.data? +infilename dq ? +outfilename dq ? +infile dq ? +outfile dq ? +inptr dq ? +workmem dq ? +insize dd ? +outsize dd ? +lzma_dictsize dd ? +indelta dd ? +strucstat rq 18 + +if defined freebsd +st_atime_offset = 24 +st_mtime_offset = 40 +st_birthtime_offset = 104 +st_size_offset = 72 +else +st_atime_offset = 72 +st_mtime_offset = 88 +;st_birthtime_offset not defined +st_size_offset = 48 +end if + +public environ +environ dq ? +public __progname +__progname dq ? +ct1 db 256 dup (?) +ctn dd ? +cti db ? + +.const +usage_str db 'Written by diamond in 2006, 2007 specially for KolibriOS',13,10 + db 'LZMA compression library is copyright (c) 1999-2005 by Igor Pavlov',13,10 + db 13,10 + db 'Usage: kerpack []',13,10 +usage_len = $ - offset usage_str +errload_str db 'Cannot load input file',13,10 +errload_len = $ - offset errload_str +outfileerr_str db 'Cannot save output file',13,10 +outfileerr_len = $ - offset outfileerr_str +nomem_str db 'No memory',13,10 +nomem_len = $ - offset nomem_str +too_big_str db 'failed, output is greater than input.',13,10 +too_big_len = $ - too_big_str +compressing_str db 'Compressing ... ' +compressing_len = $ - compressing_str + +.data +done_str db 'OK! Compression ratio: ' +ratio dw '00' + db '%',13,10,13,10 +done_len = $ - done_str + +use_lzma = 1 + +use_no_calltrick = 0 +use_calltrick1 = 40h +use_calltrick2 = 80h + +method db 1 + +.code +; Write string from [rsi] of rdx bytes. +write_string: +; 1. Align stack on 16 bytes. + push rdi +; 2. Set rdi to 1 = descriptor for stdout. + xor edi, edi + inc edi +; 3. Do system call. + call write +; 4. Restore stack and return. + pop rdi + ret + +; Write string from [rsi] of rdx bytes and exit. Note that main code jumps (not calls) here, +; so we should not align the stack. +write_exit: +; 1. Call prev func. + call write_string +; 2. Do system call for exit. +; Note that this can be used as independent proc jumped (not called) to. +doexit: + xor edi, edi + inc edi + call exit + +; Main procedure. +_start: +; 1. Parse command line. +; Linux: [rsp] = argc, rsp+8 = argv +; FreeBSD: [rdi] = argc, rdi+8 = argv +; 1a. Load argc and argv to registers, +; skip first argument (which is always program name) +if defined freebsd + mov ecx, [rdi] ; ecx = argc + add rdi, 16 ; rdi = &argv[1] +else + mov ecx, [rsp] ; ecx = argc + lea rdi, [rsp+16] ; rdi = &argv[1] +end if +; 1b. Test for first filename parameter. If no, goto step 2. + call get_file_name + jz usage +; 1c. We got input file name, save it. +; Assume that output file name is the same; if no, we will rewrite it in step 1d. + mov [infilename], rax + mov [outfilename], rax +; 1d. Test for second filename parameter. If yes, rewrite assumption in step 1c and check that there are no 3rd parameter. + call get_file_name + jz @f + mov [outfilename], rax + call get_file_name + jnz usage +@@: +; 1e. Parsing is done, process to step 3. + jmp short cont +; 2. No arguments or too many arguments given; write message and exit. +usage: + push usage_len + pop rdx + mov rsi, offset usage_str + jmp write_exit +cont: +; 4. Load the input file. +; 4a. Do system call for stat - get file times and file size. + mov rdi, [infilename] + mov rsi, offset strucstat + mov r13, rsi + call stat +; 4b. Test result; if not 0 (0 is OK), goto 4e. + test rax, rax + jnz short infileerr +; 4c. Do system call for open. + mov rdi, [infilename] + mov rsi, offset open_mode + call fopen +; 4d. Test result; if not NULL, goto 4f. + test rax, rax + jnz short inopened +infileerr: +; 4e. Say error and abort. + push errload_len + pop rdx + mov rsi, offset errload_str + jmp write_exit +inopened: + mov r12, rax +; 4f. Check that the size is nonzero and less than 4G. + mov edi, [r13+st_size_offset] + test edi, edi + jz short infileerr + cmp dword [r13+st_size_offset+4], 0 + jnz short infileerr +; 4g. Allocate memory for the input file. + mov [insize], edi + call malloc + test rax, rax + jz nomem + mov [infile], rax +; 4g. Read the input file to the allocated memory. + mov rdi, rax + push 1 + pop rsi + mov edx, [r13+st_size_offset] + mov rcx, r12 + call fread +; 4h. Test result; must be equal to file size. + cmp eax, [r13+st_size_offset] + jnz infileerr +; 4i. Close the input file. + mov rdi, r12 + call fclose +; 5. Calculate maximum size of the output. + mov edi, [insize] + shr edi, 3 + add edi, [insize] + add edi, 400h ; should be enough for header + mov r12d, edi +; 6. Allocate memory for two copies of maximum output. +; 6a. Do system call. + call malloc +; 6b. Test return value. If ok, goto 6d. + test rax, rax + jnz short outmemok +; 6c. No memory; say error and exit. +nomem: + push nomem_len + pop rdx + mov rsi, offset nomem_str + jmp write_exit +; 6d. Remember allocated memory address. +outmemok: + mov [outfile], rax +; 8. Determine and set lzma_dict_size. + push 18h + pop rdi + call lzma_set_dict_size +; 9. Allocate lzma_workmem. + mov edi, (1 shl 18h) * 19 / 2 + 509000h + call malloc + test rax, rax + jz nomem + mov [workmem], rax +; 10. Say another 'hi'. + push compressing_len + pop rdx + mov rsi, offset compressing_str + call write_string +; 11. Do work. +; find jump to 32-bit code + mov rdi, [infile] + dec rdi +@@: + inc rdi + cmp dword [rdi], 0E88EE08Eh ; mov fs,ax/mov gs,ax + jnz @b + cmp dword [rdi+4], 00BCD08Eh ; mov ss,ax/mov esp,00xxxxxx + jnz @b + add rdi, 11 + mov [inptr], rdi + sub rdi, [infile] + mov [indelta], edi + mov eax, [insize] + mov ebx, eax + add eax, 0x10000 + mov [loader_base+..loader_patch3+2], eax + sub ebx, edi + mov [insize], ebx + call preprocess_calltrick2 + mov al, [cti] + mov [loader_base+loader_patch5-1], al + mov eax, [ctn] + mov [loader_base+loader_patch4+1], eax + mov esi, [indelta] + add rsi, [outfile] + add rsi, loader_size - 5 + mov rdi, [inptr] + mov edx, [insize] + mov rcx, [workmem] + call lzma_compress + mov edx, [indelta] + add eax, loader_size-5 + mov [loader_base+loader_patch1+6], eax + add eax, edx + mov [outsize], eax + mov eax, edx + add rax, [outfile] + mov ecx, [rax + loader_size - 4] + bswap ecx + mov [loader_base+loader_patch2+4], ecx + add edx, 0x10000 + mov [loader_base+loader_patch1+1], edx + mov rsi, [infile] + mov rdi, [outfile] + mov ecx, [indelta] + rep movsb + mov rsi, loader_base + mov ecx, loader_size + rep movsb + mov eax, [outsize] + cmp eax, [insize] + jb short packed_ok + push too_big_len + pop rdx + mov rsi, offset too_big_str + jmp write_exit +packed_ok: +; 12. Main work is done. Free lzma_workmem. + mov rdi, [workmem] + call free +; 13. Set header + mov eax, [outsize] + mov ecx, 100 + mul ecx + div [insize] + mov cl, 10 + div cl + add ax, '00' + mov [ratio], ax + push done_len + pop rdx + mov rsi, offset done_str + call write_string +; 14. Save the output file. +; 14a. Do system call for open. + mov rdi, [outfilename] + mov rsi, create_mode + call fopen +; 14b. Test for success; if yes, goto 14d. + test rax, rax + jnz short @f +; 14c. Say error and exit. +outerr: + push outfileerr_len + pop rdx + mov rsi, offset outfileerr_str + jmp write_exit +; 14d. Do system call for write. +@@: + mov r12, rax + mov rdi, [outfile] + mov esi, [outsize] + push 1 + pop rdx + mov rcx, r12 + call fwrite + test eax, eax + jz short outerr +; 14e. Close output file. + mov rdi, r12 + call fclose +; 15. Exit. + xor edi, edi + call exit + +; Scan command line, skipping possible options, and return first non-option +; ecx is number of arguments left, rdi points to first new argument (updated by func) +; After the call: ZF set if no arguments left, otherwise rax points to the arg. +get_file_name: +; 1. Test whether there are still arguments. If no, goto 5; note ZF is set. + dec ecx + jz @@end +; 2. Get the new arg, advance rdi (ecx was decreased in step 1). + mov rax, [rdi] + add rdi, 8 +; 5. No arguments (ZF set) or normal argument (ZF cleared); return. +@@end: + ret + +pack_calltrick_fail: + xor eax, eax + xor ebx, ebx + mov [ctn], eax + ret + +preprocess_calltrick2: +; restore input + mov rsi, [infile] +; input preprocessing + push rax + mov edi, [insize] + add edi, edi + call malloc + pop rcx + test rax, rax + jz pack_calltrick_fail + mov rdi, offset ct1 + xchg rax, rbx + xor eax, eax + push rdi + mov ecx, 256/4 + rep stosd + pop rdi + mov ecx, [insize] + mov rsi, [inptr] + xchg eax, edx + push rbx +input_pre2: + lodsb +@@: + cmp al, 0Fh + jnz short ip1 + dec ecx + jz short input_pre_done2 + lodsb + cmp al, 80h + jb short @b + cmp al, 90h + jb short @f +ip1: + sub al, 0E8h + cmp al, 1 + ja short input_pre_cont2 +@@: + cmp ecx, 5 + jb short input_pre_done2 + lodsd + add eax, esi + sub eax, dword ptr [inptr] + cmp eax, [insize] + jae short xxx2 + cmp eax, 1000000h + jae short xxx2 + sub ecx, 4 + bswap eax + mov [rsi-4], eax + inc edx + mov [rbx], rsi + add rbx, 8 + jmp short input_pre_cont2 +xxx2: sub rsi, 4 + movzx eax, byte ptr [rsi] + mov byte ptr [rax+rdi], 1 +input_pre_cont2: + loop input_pre2 +input_pre_done2: + mov [ctn], edx + pop rdx + xor eax, eax + mov ecx, 256 + repnz scasb + jnz pack_calltrick_fail + not cl + mov [cti], cl +@@: + cmp rbx, rdx + jz @f + sub rbx, 8 + mov rax, [rbx] + mov [rax-4], cl + jmp @b +@@: + push rax + mov rdi, rbx + call free + pop rax + ret + +extrn exit +extrn fopen +extrn fread +extrn fwrite +extrn fclose +extrn fseek +extrn ftell +extrn malloc +extrn free +extrn write +extrn utimes +extrn stat + +open_mode db "rb",0 +create_mode db "wb",0 + +.data + +loader_base: +use32 +org 0 +include 'loader_lzma.asm' diff --git a/programs/other/kpack/kerpack_linux/kpack64.asm b/programs/other/kpack/kerpack_linux/kpack64.asm new file mode 100644 index 0000000000..982972fc8c --- /dev/null +++ b/programs/other/kpack/kerpack_linux/kpack64.asm @@ -0,0 +1,657 @@ +; kpack = Kolibri Packer +; Written by diamond in 2006 specially for KolibriOS + +; Uses LZMA compression library by Igor Pavlov +; (for more information on LZMA and 7-Zip visit http://www.7-zip.org) +; (plain-C packer and ASM unpacker are ported by diamond) + +;freebsd = 1 ;uncomment for FreeBSD-specific changes + + format ELF64 + public _start +.data? fix section ".bss" writeable align 4 +.data fix section ".data" writeable align 4 +.const fix section ".const" align 4 +.code fix section ".text" executable align 16 +offset fix +ptr fix +struc label type { + label . type } + +extrn lzma_compress +extrn lzma_set_dict_size + +.data? +infilename dq ? +outfilename dq ? +infile dq ? +outfile1 dq ? +outfile2 dq ? +outfile dq ? +outfilebest dq ? +workmem dq ? +insize dd ? +outsize dd ? +lzma_dictsize dd ? + dd ? +strucstat rq 18 + +if defined freebsd +st_atime_offset = 24 +st_mtime_offset = 40 +st_birthtime_offset = 104 +st_size_offset = 72 +else +st_atime_offset = 72 +st_mtime_offset = 88 +;st_birthtime_offset not defined +st_size_offset = 48 +end if + +timeval rq 2*2 +public environ +environ dq ? +public __progname +__progname dq ? +ct1 db 256 dup (?) +ctn dd ? +cti db ? + +.const +info_str db 'KPack - Kolibri Packer, version 0.11',13,10 + db 'Uses LZMA v4.32 compression library',13,10,13,10 +info_len = $ - offset info_str +usage_str db 'Written by diamond in 2006, 2007 specially for KolibriOS',13,10 + db 'LZMA compression library is copyright (c) 1999-2005 by Igor Pavlov',13,10 + db 13,10 + db 'Usage: kpack [--nologo] []',13,10 +usage_len = $ - offset usage_str +errload_str db 'Cannot load input file',13,10 +errload_len = $ - offset errload_str +outfileerr_str db 'Cannot save output file',13,10 +outfileerr_len = $ - offset outfileerr_str +nomem_str db 'No memory',13,10 +nomem_len = $ - offset nomem_str +too_big_str db 'failed, output is greater than input.',13,10 +too_big_len = $ - too_big_str +compressing_str db 'Compressing ... ' +compressing_len = $ - compressing_str + +.data +bNoLogo db 0 +done_str db 'OK! Compression ratio: ' +ratio dw '00' + db '%',13,10,13,10 +done_len = $ - done_str + +use_lzma = 1 + +use_no_calltrick = 0 +use_calltrick1 = 40h +use_calltrick2 = 80h + +method db 1 + +.code +; Write string from [rsi] of rdx bytes. +write_string: +; 1. Align stack on 16 bytes. + push rdi +; 2. Set rdi to 1 = descriptor for stdout. + xor edi, edi + inc edi +; 3. Do system call. + call write +; 4. Restore stack and return. + pop rdi + ret + +; Write string from [rsi] of rdx bytes and exit. Note that main code jumps (not calls) here, +; so we should not align the stack. +write_exit: +; 1. Call prev func. + call write_string +; 2. Do system call for exit. +; Note that this can be used as independent proc jumped (not called) to. +doexit: + xor edi, edi + call exit + +; Main procedure. +_start: +; 1. Parse command line. +; Linux: [rsp] = argc, rsp+8 = argv +; FreeBSD: [rdi] = argc, rdi+8 = argv +; 1a. Load argc and argv to registers, +; skip first argument (which is always program name) +if defined freebsd + mov ecx, [rdi] ; ecx = argc + add rdi, 16 ; rdi = &argv[1] +else + mov ecx, [rsp] ; ecx = argc + lea rdi, [rsp+16] ; rdi = &argv[1] +end if +; 1b. Test for first filename parameter. If no, goto step 2. + call get_file_name + jz usage +; 1c. We got input file name, save it. +; Assume that output file name is the same; if no, we will rewrite it in step 1d. + mov [infilename], rax + mov [outfilename], rax +; 1d. Test for second filename parameter. If yes, rewrite assumption in step 1c and check that there are no 3rd parameter. + call get_file_name + jz @f + mov [outfilename], rax + call get_file_name + jnz usage +@@: +; 1e. Parsing is done, process to step 3. + jmp short cont +; 2. No arguments or too many arguments given; write message and exit. +usage: + cmp [bNoLogo], 0 + jnz doexit + push info_len + usage_len + pop rdx + mov rsi, offset info_str;usage_str + jmp write_exit +; 3. Say hello unless disabled with --nologo. +cont: + cmp [bNoLogo], 0 + jnz @f + push info_len + pop rdx + mov rsi, info_str + call write_string +@@: +; 4. Load the input file. +; 4a. Do system call for stat - get file times and file size. + mov rdi, [infilename] + mov rsi, offset strucstat + mov r13, rsi + call stat +; 4b. Test result; if not 0 (0 is OK), goto 4e. + test rax, rax + jnz short infileerr +; 4c. Do system call for open. + mov rdi, [infilename] + mov rsi, offset open_mode + call fopen +; 4d. Test result; if not NULL, goto 4f. + test rax, rax + jnz short inopened +infileerr: +; 4e. Say error and abort. + push errload_len + pop rdx + mov rsi, offset errload_str + jmp write_exit +inopened: + mov r12, rax +; 4f. Check that the size is nonzero and less than 4G. + mov edi, [r13+st_size_offset] + test edi, edi + jz short infileerr + cmp dword [r13+st_size_offset+4], 0 + jnz short infileerr +; 4g. Allocate memory for the input file. + mov [insize], edi + call malloc + test rax, rax + jz nomem + mov [infile], rax +; 4g. Read the input file to the allocated memory. + mov rdi, rax + push 1 + pop rsi + mov edx, [r13+st_size_offset] + mov rcx, r12 + call fread +; 4h. Test result; must be equal to file size. + cmp eax, [r13+st_size_offset] + jnz infileerr +; 4i. Close the input file. + mov rdi, r12 + call fclose +; 5. Calculate maximum size of the output. + mov edi, [insize] + shr edi, 3 + add edi, [insize] + add edi, 400h ; should be enough for header + mov r12d, edi +; 6. Allocate memory for two copies of maximum output. +; 6a. Do system call. + add edi, edi + call malloc +; 6b. Test return value. If ok, goto 6d. + test rax, rax + jnz short outmemok +; 6c. No memory; say error and exit. +nomem: + push nomem_len + pop rdx + mov rsi, offset nomem_str + jmp write_exit +; 6d. Remember allocated memory address. +outmemok: + mov [outfile], rax + mov [outfile1], rax + mov [outfilebest], rax + add rax, r12 + mov [outfile2], rax + sub rax, r12 +; 7. Initialize KPCK header. + mov dword ptr [rax], 'KPCK' + mov ecx, [insize] + mov dword ptr [rax+4], ecx +; 8. Determine and set lzma_dict_size. + dec ecx + bsr eax, ecx + inc eax + cmp eax, 28 + jb short @f + mov eax, 28 +@@: + push rax + mov edi, eax + call lzma_set_dict_size + pop rcx + mov edi, 1 + shl edi, cl + mov [lzma_dictsize], edi +; 9. Allocate lzma_workmem. + imul edi, 19 + shr edi, 1 + add edi, 509000h + call malloc + test rax, rax + jz nomem + mov [workmem], rax +; 10. Say another 'hi'. + push compressing_len + pop rdx + mov rsi, offset compressing_str + call write_string +; 11. Do work. + mov rax, [outfile2] + mov [outfile], rax + xchg rax, rdi + mov rsi, [outfile1] + movsd + movsd + call pack_lzma + mov [outsize], eax + mov rax, [outfile] + mov [outfilebest], rax + mov [method], use_lzma + call preprocess_calltrick + test eax, eax + jz short noct1 + call set_outfile + call pack_lzma + add eax, 5 + cmp eax, [outsize] + jae short @f + mov [outsize], eax + mov rax, [outfile] + mov [outfilebest], rax + mov [method], use_lzma or use_calltrick1 +@@: +noct1: + call set_outfile + push qword ptr [ctn] + push qword ptr [cti] + call preprocess_calltrick2 + test eax, eax + jz noct2 + call set_outfile + call pack_lzma + add eax, 5 + cmp eax, [outsize] + jae short @f + mov [outsize], eax + mov rax, [outfile] + mov [outfilebest], rax + mov [method], use_lzma or use_calltrick2 + pop rcx + pop rcx + push qword ptr [ctn] + push qword ptr [cti] +@@: +noct2: + pop rax + mov [cti], al + pop rax + mov [ctn], eax + add [outsize], 12 + mov eax, [outsize] + cmp eax, [insize] + jb short packed_ok + push too_big_len + pop rdx + mov rsi, offset too_big_str + jmp write_exit +packed_ok: +; 12. Main work is done. Free lzma_workmem. + mov rdi, [workmem] + call free +; 13. Set header + movzx eax, [method] + mov rdi, [outfilebest] + mov [rdi+8], eax + test al, use_calltrick1 or use_calltrick2 + jz short @f + mov ecx, [outsize] + add rcx, rdi + mov eax, [ctn] + mov [rcx-5], eax + mov al, [cti] + mov [rcx-1], al +@@: + mov eax, [outsize] + mov ecx, 100 + mul ecx + div [insize] + mov cl, 10 + div cl + add ax, '00' + mov [ratio], ax + push done_len + pop rdx + cmp [bNoLogo], 0 + jz @f + sub dl, 2 +@@: + mov rsi, offset done_str + call write_string +; 14. Save the output file. +; 14a. Do system call for open. + mov rdi, [outfilename] + mov rsi, create_mode + call fopen +; 14b. Test for success; if yes, goto 14d. + test rax, rax + jnz short @f +; 14c. Say error and exit. +outerr: + push outfileerr_len + pop rdx + mov rsi, offset outfileerr_str + jmp write_exit +; 14d. Do system call for write. +@@: + mov r12, rax + mov rdi, [outfilebest] + mov esi, [outsize] + push 1 + pop rdx + mov rcx, r12 + call fwrite + test eax, eax + jz short outerr +; 14e. Close output file. + mov rdi, r12 + call fclose +; 14f. Set output file time from the input file. +; Do two system calls, one for birth time, one for modification time. + mov rdi, [outfilename] + mov rsi, timeval + mov rax, [r13+st_atime_offset] + mov [rsi], rax + mov rax, [r13+st_atime_offset+8] + mov [rsi+8], rax +if defined st_birthtime_offset + mov rax, [r13+st_birthtime_offset] + mov [rsi+16], rax + mov rax, [r13+st_birthtime_offset+8] + mov [rsi+24], rax + call utimes + mov rdi, [outfilename] + mov rsi, timeval +end if + mov rax, [r13+st_mtime_offset] + mov [rsi+16], rax + mov rax, [r13+st_mtime_offset+8] + mov [rsi+24], rax + call utimes +; 15. Exit. + xor edi, edi + call exit + +; Scan command line, skipping possible options, and return first non-option +; ecx is number of arguments left, rdi points to first new argument (updated by func) +; After the call: ZF set if no arguments left, otherwise rax points to the arg. +get_file_name: +; 1. Test whether there are still arguments. If no, goto 5; note ZF is set. + dec ecx + jz @@end +; 2. Get the new arg, advance rdi (ecx was decreased in step 1). + mov rax, [rdi] + add rdi, 8 +; 3. Test for --nologo option. If no, goto 5; note ZF is cleared. + cmp dword [rax], '--no' + jnz @@end + cmp dword [rax+4], 'logo' + jnz @@end +; 4. Remember that --nologo was given and continue from the beginning. + mov [bNoLogo], 1 + jmp get_file_name +; 5. No arguments (ZF set) or normal argument (ZF cleared); return. +@@end: + ret + +set_outfile: + mov rax, [outfilebest] + xor rax, [outfile1] + xor rax, [outfile2] + mov [outfile], rax + ret + +pack_calltrick_fail: + xor eax, eax + xor ebx, ebx + mov [ctn], eax + ret +preprocess_calltrick: +; input preprocessing + push rax + mov edi, [insize] + add edi, edi + call malloc + pop rcx + test rax, rax + jz pack_calltrick_fail + push rax + xor eax, eax + mov rdi, offset ct1 + mov ecx, 256/4 + push rdi + rep stosd + pop rdi + mov ecx, [insize] + mov rsi, [infile] + xchg eax, edx + pop rax + xchg rax, rbx + push rbx +input_pre: + lodsb + sub al, 0E8h + cmp al, 1 + ja short input_pre_cont + cmp ecx, 5 + jb short input_pre_done + lodsd + add eax, esi + sub eax, dword ptr [infile] + cmp eax, [insize] + jae short xxx + cmp eax, 1000000h + jae short xxx + sub ecx, 4 + bswap eax + mov [rsi-4], eax + inc edx + mov [rbx], rsi + add rbx, 8 + jmp short input_pre_cont +xxx: sub rsi, 4 + movzx eax, byte ptr [rsi] + mov byte ptr [rax+rdi], 1 +input_pre_cont: + loop input_pre +input_pre_done: + mov [ctn], edx + pop rdx + xor eax, eax + mov ecx, 256 + repnz scasb + jnz pack_calltrick_fail + not cl + mov [cti], cl +@@: + cmp rbx, rdx + jz @f + sub rbx, 8 + mov rax, [rbx] + mov [rax-4], cl + jmp @b +@@: + push rax + mov rdi, rbx + call free + pop rax + ret + +pack_lzma: + push rcx + mov rdi, [infile] + mov rsi, [outfile] + add rsi, 11 + mov edx, [insize] + mov rcx, [workmem] + call lzma_compress + pop rcx + mov rcx, [outfile] + mov edx, [rcx+12] + bswap edx + mov [rcx+12], edx + dec eax + ret + +preprocess_calltrick2: +; restore input + mov rsi, [infile] + mov ecx, [ctn] + jecxz pc2l2 +pc2l1: + lodsb + sub al, 0E8h + cmp al, 1 + ja short pc2l1 + mov al, [cti] + cmp [rsi], al + jnz short pc2l1 + lodsd + mov al, 0 + bswap eax + sub eax, esi + add eax, dword ptr [infile] + mov [rsi-4], eax + loop pc2l1 +pc2l2: +; input preprocessing + push rax + mov edi, [insize] + add edi, edi + call malloc + pop rcx + test rax, rax + jz pack_calltrick_fail + mov rdi, offset ct1 + xchg rax, rbx + xor eax, eax + push rdi + mov ecx, 256/4 + rep stosd + pop rdi + mov ecx, [insize] + mov rsi, [infile] + xchg eax, edx + push rbx +input_pre2: + lodsb +@@: + cmp al, 0Fh + jnz short ip1 + dec ecx + jz short input_pre_done2 + lodsb + cmp al, 80h + jb short @b + cmp al, 90h + jb short @f +ip1: + sub al, 0E8h + cmp al, 1 + ja short input_pre_cont2 +@@: + cmp ecx, 5 + jb short input_pre_done2 + lodsd + add eax, esi + sub eax, dword ptr [infile] + cmp eax, [insize] + jae short xxx2 + cmp eax, 1000000h + jae short xxx2 + sub ecx, 4 + bswap eax + mov [rsi-4], eax + inc edx + mov [rbx], rsi + add rbx, 8 + jmp short input_pre_cont2 +xxx2: sub rsi, 4 + movzx eax, byte ptr [rsi] + mov byte ptr [rax+rdi], 1 +input_pre_cont2: + loop input_pre2 +input_pre_done2: + mov [ctn], edx + pop rdx + xor eax, eax + mov ecx, 256 + repnz scasb + jnz pack_calltrick_fail + not cl + mov [cti], cl +@@: + cmp rbx, rdx + jz @f + sub rbx, 8 + mov rax, [rbx] + mov [rax-4], cl + jmp @b +@@: + push rax + mov rdi, rbx + call free + pop rax + ret + +extrn exit +extrn fopen +extrn fread +extrn fwrite +extrn fclose +extrn fseek +extrn ftell +extrn malloc +extrn free +extrn write +extrn utimes +extrn stat + +open_mode db "rb",0 +create_mode db "wb",0 diff --git a/programs/other/kpack/kerpack_linux/loader_lzma.asm b/programs/other/kpack/kerpack_linux/loader_lzma.asm new file mode 100644 index 0000000000..3c4ab5b3b7 --- /dev/null +++ b/programs/other/kpack/kerpack_linux/loader_lzma.asm @@ -0,0 +1,404 @@ +loader_start: +; start address; this code will be injected after the init code +; (some commands below "B32" in the kernel) + mov edi, 0x280000 + lea ebx, [edi+loader_size1+16] + lea edx, [ebx+4] +loader_patch1: + mov esi, 0 ; will be patched: start address to copy + mov ecx, 0 ; will be patched: size of data to copy + push esi + rep movsb + jmp edx +loader_size1 = $ - loader_start + +loader_patch2: + dd 0x280000 + loader_size + dd 0 ; will be patched: start value for code + ; (LZMA-specific) + dd -1 + dd _RangeDecoderBitDecode_edx - loader_start + 0x280000 + dd _RangeDecoderBitDecode - loader_start + 0x280000 +RangeDecoderBitDecode equ dword [ebx] +RangeDecoderBitDecode_edx equ dword [ebx-4] +code_ equ ebx-12 +range equ ebx-8 + +rep1 equ ebx-28 +rep2 equ ebx-24 +rep3 equ ebx-20 +inptr_ldr equ ebx-16 + +pb equ 0 ; pos state bits +lp equ 0 ; literal pos state bits +lc equ 3 ; literal context bits +posStateMask equ ((1 shl pb)-1) +literalPosMask equ ((1 shl lp)-1) + +kNumPosBitsMax = 4 +kNumPosStatesMax = (1 shl kNumPosBitsMax) + +kLenNumLowBits = 3 +kLenNumLowSymbols = (1 shl kLenNumLowBits) +kLenNumMidBits = 3 +kLenNumMidSymbols = (1 shl kLenNumMidBits) +kLenNumHighBits = 8 +kLenNumHighSymbols = (1 shl kLenNumHighBits) + +LenChoice = 0 +LenChoice2 = 1 +LenLow = 2 +LenMid = (LenLow + (kNumPosStatesMax shl kLenNumLowBits)) +LenHigh = (LenMid + (kNumPosStatesMax shl kLenNumMidBits)) +kNumLenProbs = (LenHigh + kLenNumHighSymbols) + +kNumStates = 12 +kNumLitStates = 7 +kStartPosModelIndex = 4 +kEndPosModelIndex = 14 +kNumFullDistances = (1 shl (kEndPosModelIndex/2)) +kNumPosSlotBits = 6 +kNumLenToPosStates = 4 +kNumAlignBits = 4 +kAlignTableSize = (1 shl kNumAlignBits) +kMatchMinLen = 2 + +IsMatch = 0 +IsRep = 0xC0 ; (IsMatch + (kNumStates shl kNumPosBitsMax)) +IsRepG0 = 0xCC ; (IsRep + kNumStates) +IsRepG1 = 0xD8 ; (IsRepG0 + kNumStates) +IsRepG2 = 0xE4 ; (IsRepG1 + kNumStates) +IsRep0Long = 0xF0 ; (IsRepG2 + kNumStates) +PosSlot = 0x1B0 ; (IsRep0Long + (kNumStates shl kNumPosBitsMax)) +SpecPos = 0x2B0 ; (PosSlot + (kNumLenToPosStates shl kNumPosSlotBits)) +Align_ = 0x322 ; (SpecPos + kNumFullDistances - kEndPosModelIndex) +Lencoder = 0x332 ; (Align_ + kAlignTableSize) +RepLencoder = 0x534 ; (Lencoder + kNumLenProbs) +Literal = 0x736 ; (RepLencoder + kNumLenProbs) + +LZMA_BASE_SIZE = 1846 ; must be ==Literal +LZMA_LIT_SIZE = 768 + +kNumTopBits = 24 +kTopValue = (1 shl kNumTopBits) + +kNumBitModelTotalBits = 11 +kBitModelTotal = (1 shl kNumBitModelTotalBits) +kNumMoveBits = 5 + +uninit_base = 2C0000h + +p = uninit_base + +unpacker: + xor ebp, ebp + xor eax, eax + dec eax + lea edi, [rep1] + stosd + stosd + stosd + xchg eax, esi +; mov ecx, Literal + (LZMA_LIT_SIZE shl (lc+lp)) + mov ch, (Literal + (LZMA_LIT_SIZE shl (lc+lp)) + 0xFF) shr 8 + mov eax, kBitModelTotal/2 + mov edi, p + rep stosd + pop edi + push edi +.main_loop: +..loader_patch3: + cmp edi, dword 0 ; will be patched: end of data to unpack + jae .main_loop_done +if posStateMask + mov edx, edi + and edx, posStateMask +else + xor edx, edx +end if + push eax ; al = previous byte + lea eax, [ebp + ((p+IsMatch*4) shr (kNumPosBitsMax+2))] + shl eax, kNumPosBitsMax+2 +if posStateMask + call RangeDecoderBitDecode_edx +else + call RangeDecoderBitDecode +end if + pop eax + jc .1 + movzx eax, al +if literalPosMask + mov ah, dl + and ah, literalPosMask +end if +if ((LZMA_LIT_SIZE*4) and ((1 shl (8-lc)) - 1)) <> 0 + shr eax, 8-lc + imul eax, LZMA_LIT_SIZE*4 +else + and al, not ((1 shl (8-lc)) - 1) + imul eax, (LZMA_LIT_SIZE*4) shr (8-lc) +end if + add eax, p+Literal*4 + mov dl, 1 + cmp ebp, kNumLitStates + jb .literal + mov cl, [edi + esi] +.lx0: + add cl, cl + adc dh, 1 + call RangeDecoderBitDecode_edx + adc dl, dl + jc .lx1 + xor dh, dl + test dh, 1 + mov dh, 0 + jnz .lx0 +.literal: +@@: + call RangeDecoderBitDecode_edx + adc dl, dl + jnc @b +.lx1: + mov eax, ebp + cmp al, 4 + jb @f + cmp al, 10 + mov al, 3 + jb @f + mov al, 6 +@@: sub ebp, eax + xchg eax, edx +.stosb_main_loop: + stosb + jmp .main_loop +.1: + lea eax, [p + IsRep*4 + ebp*4] + call RangeDecoderBitDecode + jnc .10 + add eax, (IsRepG0 - IsRep)*4 ;lea eax, [p + IsRepG0*4 + ebp*4] + call RangeDecoderBitDecode + jc .111 + mov eax, ebp + shl eax, kNumPosBitsMax+2 + add eax, p + IsRep0Long*4 + call RangeDecoderBitDecode_edx + jc .1101 + cmp ebp, 7 + sbb ebp, ebp + lea ebp, [ebp+ebp+11] + mov al, [edi + esi] + jmp .stosb_main_loop +.111: + add eax, (IsRepG1 - IsRepG0) * 4 ;lea eax, [p + IsRepG1*4 + ebp*4] + call RangeDecoderBitDecode + xchg esi, [rep1] + jnc @f + add eax, (IsRepG2 - IsRepG1) * 4 ;lea eax, [p + IsRepG2*4 + ebp*4] + call RangeDecoderBitDecode + xchg esi, [rep2] + jnc @f + xchg esi, [rep3] +@@: +.1101: + mov eax, p + RepLencoder*4 + call LzmaLenDecode + push 8 + jmp .rmu +.10: + xchg esi, [rep1] + xchg esi, [rep2] + mov [rep3], esi + mov eax, p + Lencoder*4 + call LzmaLenDecode + push kNumLenToPosStates-1 + pop edx + cmp edx, ecx + jb @f + mov edx, ecx +@@: + push ecx + push kNumPosSlotBits + pop ecx + mov eax, p+PosSlot*4 + shl edx, cl + call RangeDecoderBitTreeDecode + mov esi, ecx + cmp ecx, kStartPosModelIndex + jb .l6 + mov edx, ecx + xor eax, eax + shr ecx, 1 + adc al, 2 + dec ecx + shl eax, cl + mov esi, eax + sub eax, edx + lea eax, [p + (SpecPos - 1)*4 + eax*4] + cmp edx, kEndPosModelIndex + jb .l59 +; call RangeDecoderDecodeDirectBits +;RangeDecoderDecodeDirectBits: + xor eax, eax +.l: + shr dword [range], 1 + add eax, eax + mov edx, [code_] + sub edx, [range] + jb @f + mov [code_], edx + add al, 1 shl kNumAlignBits +@@: + call update_decoder + dec ecx + cmp ecx, kNumAlignBits + jnz .l +; ret + add esi, eax + mov eax, p+Align_*4 +.l59: +; call RangeDecoderReverseBitTreeDecode_addesi +;_RangeDecoderReverseBitTreeDecode_addesi: +; in: eax->probs,ecx=numLevels +; out: esi+=length; destroys edx + push edi + xor edx, edx + inc edx + mov edi, edx +@@: + call RangeDecoderBitDecode_edx + jnc .591 + add esi, edi + stc +.591: + adc edx, edx + add edi, edi + loop @b + pop edi +; ret +.l6: + pop ecx + not esi + push 7 +.rmu: + cmp ebp, 7 + pop ebp + jb @f + add ebp, 3 +@@: +.repmovsb: + inc ecx + push esi + add esi, edi + rep movsb + lodsb + pop esi + jmp .stosb_main_loop +.main_loop_done: +include 'calltrick2.asm' + ret + +_RangeDecoderBitDecode: +; in: eax->prob +; out: CF=bit + push edx + mov edx, [range] + shr edx, kNumBitModelTotalBits + imul edx, [eax] + cmp [code_], edx + jae .ae + mov [range], edx + mov edx, kBitModelTotal + sub edx, [eax] + shr edx, kNumMoveBits + add [eax], edx +.n: + pushfd + call update_decoder + popfd + pop edx + ret +.ae: + sub [range], edx + sub [code_], edx + mov edx, [eax] + shr edx, kNumMoveBits + sub [eax], edx + stc + jmp .n + +update_decoder: + cmp byte [range+3], 0 ;cmp dword [range], kTopValue + jnz @f ;jae @f + shl dword [range], 8 + shl dword [code_], 8 + push eax + mov eax, [inptr_ldr] + mov al, [eax] + inc dword [inptr_ldr] + mov byte [code_], al + pop eax +@@: ret + +_RangeDecoderBitDecode_edx: + push eax + lea eax, [eax+edx*4] + call RangeDecoderBitDecode + pop eax + ret + +LzmaLenDecode: +; in: eax->prob, edx=posState +; out: ecx=len + +; LenChoice==0 +; add eax, LenChoice*4 +if kLenNumMidBits <> kLenNumLowBits +error in optimization +end if + mov cl, kLenNumMidBits + call RangeDecoderBitDecode + jnc .0 + add eax, (LenChoice2-LenChoice)*4 + call RangeDecoderBitDecode + jc @f +if (kLenNumMidBits <> 3) | (LenMid-LenChoice2 > 0x7F + kLenNumMidBits) + shl edx, cl + add edx, LenMid-LenChoice2 +else + lea edx, [ecx + edx*8 - kLenNumMidBits + LenMid-LenChoice2] +end if + push kLenNumLowSymbols + jmp RangeDecoderBitTreeDecode.1 +@@: + mov edx, LenHigh-LenChoice2 + mov cl, kLenNumHighBits + push kLenNumLowSymbols + kLenNumMidSymbols + jmp RangeDecoderBitTreeDecode.1 +.0: + shl edx, cl +if LenLow = 2 + inc edx + inc edx +else + add edx, LenLow +end if +RangeDecoderBitTreeDecode: +; in: eax+edx*4->probs,ecx=numLevels +; out: ecx=length; destroys edx + push 0 +.1: + lea eax, [eax+edx*4] + xor edx, edx + inc edx + push ecx +@@: + call RangeDecoderBitDecode_edx + adc edx, edx + loop @b + pop ecx + btc edx, ecx + pop ecx + add ecx, edx + ret + +loader_size = $ - loader_start diff --git a/programs/other/kpack/kerpack_linux/lzma_c/LZMAEncoder.c b/programs/other/kpack/kerpack_linux/lzma_c/LZMAEncoder.c new file mode 100644 index 0000000000..617892e69c --- /dev/null +++ b/programs/other/kpack/kerpack_linux/lzma_c/LZMAEncoder.c @@ -0,0 +1,1078 @@ +#include "LZMAEncoder.h" +#include "MatchFinder.h" + +const byte kLiteralNextStates[kNumStates] = {0,0,0,0,1,2,3,4,5,6,4,5}; +const byte kMatchNextStates[kNumStates] = {7,7,7,7,7,7,7,10,10,10,10,10}; +const byte kRepNextStates[kNumStates] = {8,8,8,8,8,8,8,11,11,11,11,11}; +const byte kShortRepNextStates[kNumStates] = {9,9,9,9,9,9,9,11,11,11,11,11}; + +static CState _state; +static byte _previousByte; +static unsigned _repDistances[kNumRepDistances]; + +static COptimal _optimum[kNumOpts]; +static CMyBitEncoder _isMatch[kNumStates][kNumPosStatesEncodingMax]; +static CMyBitEncoder _isRep[kNumStates]; +static CMyBitEncoder _isRepG0[kNumStates]; +static CMyBitEncoder _isRepG1[kNumStates]; +static CMyBitEncoder _isRepG2[kNumStates]; +static CMyBitEncoder _isRep0Long[kNumStates][kNumPosStatesEncodingMax]; +static NRangeCoder_CBitTreeEncoder _posSlotEncoder[kNumLenToPosStates]; +static CMyBitEncoder _posEncoders[kNumFullDistances - kEndPosModelIndex]; +static NRangeCoder_CBitTreeEncoder _posAlignEncoder; +static NLength_CPriceTableEncoder _lenEncoder; +static NLength_CPriceTableEncoder _repMatchLenEncoder; +static CLiteralEncoder _literalEncoder; +static unsigned _matchDistances[kMatchMaxLen+1]; +static unsigned _numFastBytes; +static unsigned _longestMatchLength; +static unsigned _additionalOffset; +static unsigned _optimumEndIndex; +static unsigned _optimumCurrentIndex; +static bool _longestMatchWasFound; +static unsigned _posSlotPrices[kNumLenToPosStates][kDistTableSizeMax]; +static unsigned _distancesPrices[kNumLenToPosStates][kNumFullDistances]; +static unsigned _alignPrices[kAlignTableSize]; +static unsigned _alignPriceCount; +static unsigned _distTableSize; +static unsigned _posStateBits; +static unsigned _posStateMask; +static unsigned _numLiteralPosStateBits; +static unsigned _numLiteralContextBits; +static unsigned _dictionarySize; +static uint64 lastPosSlotFillingPos; +static uint64 nowPos64; +static bool _finished; +static bool _writeEndMark; + +static byte g_FastPos[1024]; + +// must be called before work +static void FastPosInit(void) +{ + int c = 2; + int slotFast; + unsigned j,k; + g_FastPos[0] = 0; + g_FastPos[1] = 1; + for (slotFast = 2; slotFast < 20; slotFast++) + { + k = (1 << ((slotFast >> 1) - 1)); + for (j=0;j>9]+18; + return g_FastPos[pos>>18]+36; +} +static unsigned GetPosSlot2(unsigned pos) +{ + if (pos < (1<<16)) + return g_FastPos[pos>>6]+12; + if (pos < (1<<25)) + return g_FastPos[pos>>15]+30; + return g_FastPos[pos>>24]+48; +} + +unsigned pack_length; +unsigned pack_pos; +const byte* curin; +byte* curout; + +static void NLength_CEncoder_Init(NLength_CEncoder*e, unsigned numPosStates) +{ + unsigned posState; + CMyBitEncoder_Init(e->_choice); + CMyBitEncoder_Init(e->_choice2); + for (posState=0;posState_lowCoder[posState],kNumLowBits); + CBitTreeEncoder_Init(&e->_midCoder[posState],kNumMidBits); + } + CBitTreeEncoder_Init(&e->_highCoder,kNumHighBits); +} + +static void NLength_CEncoder_Encode(NLength_CEncoder*e, unsigned symbol, unsigned posState) +{ + if (symbol < kNumLowSymbols) + { + CMyBitEncoder_Encode(&e->_choice,0); + CBitTreeEncoder_Encode(&e->_lowCoder[posState],symbol); + } + else + { + CMyBitEncoder_Encode(&e->_choice,1); + if (symbol < kNumLowSymbols + kNumMidSymbols) + { + CMyBitEncoder_Encode(&e->_choice2,0); + CBitTreeEncoder_Encode(&e->_midCoder[posState],symbol-kNumLowSymbols); + } + else + { + CMyBitEncoder_Encode(&e->_choice2,1); + CBitTreeEncoder_Encode(&e->_highCoder,symbol-kNumLowSymbols-kNumMidSymbols); + } + } +} + +static unsigned NLength_CEncoder_GetPrice(NLength_CEncoder*e, unsigned symbol, unsigned posState) +{ + unsigned price; + if (symbol < kNumLowSymbols) + return CMyBitEncoder_GetPrice0(&e->_choice) + + CBitTreeEncoder_GetPrice(&e->_lowCoder[posState],symbol); + price = CMyBitEncoder_GetPrice1(&e->_choice); + if (symbol < kNumLowSymbols + kNumMidSymbols) + { + price += CMyBitEncoder_GetPrice0(&e->_choice2); + price += CBitTreeEncoder_GetPrice(&e->_midCoder[posState],symbol-kNumLowSymbols); + } + else + { + price += CMyBitEncoder_GetPrice1(&e->_choice2); + price += CBitTreeEncoder_GetPrice(&e->_highCoder,symbol-kNumLowSymbols-kNumMidSymbols); + } + return price; +} + +static void CPriceTableEncoder_SetTableSize(NLength_CPriceTableEncoder*pte,unsigned tableSize) +{pte->_tableSize = tableSize;} +static unsigned CPriceTableEncoder_GetPrice(NLength_CPriceTableEncoder*pte,unsigned symbol,unsigned posState) +{return pte->_prices[symbol][posState];} +static void CPriceTableEncoder_UpdateTable(NLength_CPriceTableEncoder*pte,unsigned posState) +{ + unsigned len; + for (len=0;len_tableSize;len++) + pte->_prices[len][posState] = NLength_CEncoder_GetPrice(&pte->base,len,posState); + pte->_counters[posState] = pte->_tableSize; +} +static void CPriceTableEncoder_UpdateTables(NLength_CPriceTableEncoder*pte,unsigned numPosStates) +{ + unsigned posState; + for (posState=0;posStatebase,symbol,posState); + if (--pte->_counters[posState] == 0) + CPriceTableEncoder_UpdateTable(pte,posState); +} + +static void CBaseState_Init(void) +{ + unsigned i; + CState_Init(_state); + _previousByte = 0; + for (i=0;i> i) & 1; + CMyBitEncoder_Encode(&le[context],bit); + context = (context << 1) | bit; + } +} + +static void CLiteralEncoder2_EncodeMatched(CLiteralEncoder2 le, byte matchByte, byte symbol) +{ + unsigned context = 1; + int i; + unsigned bit,matchBit; + for (i=8;i--;) + { + bit = (symbol >> i) & 1; + matchBit = (matchByte >> i) & 1; + CMyBitEncoder_Encode(&le[0x100 + (matchBit<<8) + context],bit); + context = (context << 1) | bit; + if (matchBit != bit) + { + while (i--) + { + bit = (symbol >> i) & 1; + CMyBitEncoder_Encode(&le[context],bit); + context = (context << 1) | bit; + } + break; + } + } +} + +static unsigned CLiteralEncoder2_GetPrice(CLiteralEncoder2 le, bool matchMode, byte matchByte, byte symbol) +{ + unsigned price = 0; + unsigned context = 1; + unsigned bit,matchBit; + int i = 8; + if (matchMode) + { + do + { + i--; + matchBit = (matchByte >> i) & 1; + bit = (symbol >> i) & 1; + price += CMyBitEncoder_GetPrice(&le[0x100 + (matchBit<<8) + context],bit); + context = (context << 1) | bit; + if (matchBit != bit) + break; + } while (i); + } + while (i--) + { + bit = (symbol >> i) & 1; + price += CMyBitEncoder_GetPrice(&le[context],bit); + context = (context << 1) | bit; + } + return price; +} + +static void WriteEndMarker(unsigned posState) +{ + unsigned posSlot; + if (!_writeEndMark) + return; + CMyBitEncoder_Encode(&_isMatch[_state][posState],1); + CMyBitEncoder_Encode(&_isRep[_state],0); + CState_UpdateMatch(_state); + CPriceTableEncoder_Encode(&_lenEncoder,0,posState); + posSlot = (1<>kNumAlignBits,30-kNumAlignBits); + CBitTreeEncoder_ReverseEncode(&_posAlignEncoder,((1<<30)-1) & kAlignMask); +} + +static void CEncoder_Flush(void) +{ + WriteEndMarker((unsigned)nowPos64 & _posStateMask); + RangeEncoder_FlushData(); +} + +static void CLiteralEncoder_Create(CLiteralEncoder*le, byte** memory, int numPosBits, int numPrevBits) +{ + unsigned numStates; + le->_coders = (CLiteralEncoder2*)*memory; + numStates = 1 << (numPosBits+numPrevBits); + *memory = (byte*)(le->_coders + numStates); + le->_numPosBits = numPosBits; + le->_posMask = (1<_numPrevBits = numPrevBits; +} + +static void CLiteralEncoder_Init(CLiteralEncoder*le) +{ + unsigned numStates,i; + numStates = 1 << (le->_numPosBits + le->_numPrevBits); + for (i=0;i_coders[i]); +} + +static unsigned CLiteralEncoder_GetState(CLiteralEncoder*le,unsigned pos,byte prevByte) +{return ((pos&le->_posMask)<_numPrevBits)+(prevByte>>(8-le->_numPrevBits));} +static CLiteralEncoder2* CLiteralEncoder_GetSubCoder(CLiteralEncoder*le,unsigned pos,byte prevByte) +{return &le->_coders[CLiteralEncoder_GetState(le,pos,prevByte)];} + +static unsigned CLiteralEncoder_GetPrice(CLiteralEncoder*le,unsigned pos,byte prevByte, + bool matchMode, byte matchByte, byte symbol) +{ + return CLiteralEncoder2_GetPrice(le->_coders[CLiteralEncoder_GetState(le,pos,prevByte)], + matchMode, matchByte, symbol); +} + +static void CEncoder_Create(void*workmem) +{ + byte* workpos = (byte*)workmem; + /* align on dword boundary */ + unsigned a; + a = (unsigned)workpos & 3; + if (a) workpos += 4-a; + /* sizeof(CLiteralEncoder2) * (1<<(numPosBits+numPrevBits)) for literal encoders */ + /* = 0xC00 * 8 = 0x6000 with current settings */ + CLiteralEncoder_Create(&_literalEncoder,&workpos,_numLiteralPosStateBits,_numLiteralContextBits); + /* (dictsize+0x1223)*1.5+256 for LZ input window */ + /* (0x140400 + (dictsize+1)*2) * 4 for match finder hash */ + MatchFinder_Create(_dictionarySize,kNumOpts,_numFastBytes, + kMatchMaxLen*2+1-_numFastBytes,&workpos); + /* total 0x508C3C + dictsize*9.5 */ + /* plus max 6 bytes for alignment */ +} + +static void CEncoder_Init(void) +{ + int i; + unsigned j; + CBaseState_Init(); + RangeEncoder_Init(); + for (i=0;i>1)-1-kNumAlignBits)<>1)-1); + base = (2|(posSlot&1))<=0x80) + return kIfinityPrice; + lenToPosState = GetLenToPosState(len); + if (pos < kNumFullDistances) + price = _distancesPrices[lenToPosState][pos]; + else + price = _posSlotPrices[lenToPosState][GetPosSlot2(pos)] + + _alignPrices[pos & kAlignMask]; + return price + CPriceTableEncoder_GetPrice(&_lenEncoder,len-kMatchMinLen,posState); +} + +static void GetOptimum(unsigned position,unsigned*backRes,unsigned*lenRes) +{ + int lenMain,lenEnd; + COptimal* opt,*prevOpt; + int reps[kNumRepDistances]; + int repLens[kNumRepDistances]; + int repIndex,repMaxIndex; + int i,len,repLen,lenTest,newLen,lenTestTemp,lenTest2; + int posState,posStateNext; + byte currentByte,matchByte; + unsigned matchPrice,repMatchPrice,shortRepPrice,normalMatchPrice,curAndLenPrice,curPrice,curAnd1Price,curAndLenCharPrice; + unsigned nextMatchPrice,nextRepMatchPrice; + int cur,posPrev,pos; + CState state,state2; + const byte* data; + bool nextIsChar; + int numAvailableBytesFull,numAvailableBytes; + int backOffset,offset; + int limit; + if (_optimumEndIndex != _optimumCurrentIndex) + { + opt = &_optimum[_optimumCurrentIndex]; + *lenRes = opt->PosPrev - _optimumCurrentIndex; + *backRes = opt->BackPrev; + _optimumCurrentIndex = opt->PosPrev; + return; + } + _optimumCurrentIndex = _optimumEndIndex = 0; + if (!_longestMatchWasFound) + lenMain = ReadMatchDistances(); + else + { + lenMain = _longestMatchLength; + _longestMatchWasFound = false; + } + for (i=0;i repLens[repMaxIndex]) + repMaxIndex = i; + } + if (repLens[repMaxIndex] >= _numFastBytes) + { + *backRes = repMaxIndex; + *lenRes = repLens[repMaxIndex]; + MovePos(*lenRes-1); + return; + } + if (lenMain >= _numFastBytes) + { + *backRes = _matchDistances[_numFastBytes]+kNumRepDistances; + *lenRes = lenMain; + MovePos(lenMain-1); + return; + } + currentByte = GetIndexByte(0-1); + _optimum[0].State = _state; + matchByte = GetIndexByte(0-_repDistances[0]-2); + posState = position & _posStateMask; + _optimum[1].Price = CMyBitEncoder_GetPrice0(&_isMatch[_state][posState]) + + CLiteralEncoder_GetPrice(&_literalEncoder,position,_previousByte, + (bool)!CState_IsCharState(_state),matchByte,currentByte); + COptimal_MakeAsChar(&_optimum[1]); + _optimum[1].PosPrev = 0; + for (i=0;iPrice) + { + opt->Price = curAndLenPrice; + opt->PosPrev = 0; + opt->BackPrev = i; + opt->Prev1IsChar = false; + } + } + } + cur=0; + lenEnd = lenMain; + while (1) + { + cur++; + if (cur==lenEnd) + { + *lenRes = Backward(backRes,cur); + return; + } + position++; + opt = &_optimum[cur]; + posPrev = opt->PosPrev; + if (opt->Prev1IsChar) + { + posPrev--; + if (opt->Prev2) + { + state = _optimum[opt->PosPrev2].State; + if (opt->BackPrev2 < kNumRepDistances) + CState_UpdateRep(state); + else + CState_UpdateMatch(state); + } + else + state = _optimum[posPrev].State; + CState_UpdateChar(state); + } + else + state = _optimum[posPrev].State; + if (posPrev == cur-1) + { + if (COptimal_IsShortRep(opt)) + CState_UpdateShortRep(state); + else + CState_UpdateChar(state); + } + else + { + if (opt->Prev1IsChar && opt->Prev2) + { + posPrev = opt->PosPrev2; + pos = opt->BackPrev2; + CState_UpdateRep(state); + } + else + { + pos = opt->BackPrev; + if (pos < kNumRepDistances) + CState_UpdateRep(state); + else + CState_UpdateMatch(state); + } + prevOpt = &_optimum[posPrev]; + if (pos < kNumRepDistances) + { + reps[0] = prevOpt->Backs[pos]; + for (i=1;i<=pos;i++) + reps[i] = prevOpt->Backs[i-1]; + for (;iBacks[i]; + } + else + { + reps[0] = pos-kNumRepDistances; + for (i=1;iBacks[i-1]; + } + } + opt->State = state; + for (i=0;iBacks[i] = reps[i]; + newLen = ReadMatchDistances(); + if (newLen >= _numFastBytes) + { + _longestMatchLength = newLen; + _longestMatchWasFound = true; + *lenRes = Backward(backRes,cur); + return; + } + curPrice = opt->Price; + data = GetPointerToCurrentPos()-1; + currentByte = *data; + matchByte = data[-1-reps[0]]; + posState = position & _posStateMask; + curAnd1Price = curPrice + CMyBitEncoder_GetPrice0(&_isMatch[state][posState]) + + CLiteralEncoder_GetPrice(&_literalEncoder,position,data[-1],(bool)!CState_IsCharState(state),matchByte,currentByte); + opt = &_optimum[cur+1]; + nextIsChar = false; + if (curAnd1Price < opt->Price) + { + opt->Price = curAnd1Price; + opt->PosPrev = cur; + COptimal_MakeAsChar(opt); + nextIsChar = true; + } + matchPrice = curPrice + CMyBitEncoder_GetPrice1(&_isMatch[state][posState]); + repMatchPrice = matchPrice + CMyBitEncoder_GetPrice1(&_isRep[state]); + if (matchByte == currentByte && !(opt->PosPrevBackPrev)) + { + shortRepPrice = repMatchPrice + GetRepLen1Price(state,posState); + if (shortRepPrice <= opt->Price) + { + opt->Price = shortRepPrice; + opt->PosPrev = cur; + COptimal_MakeAsShortRep(opt); + } + } + numAvailableBytesFull = GetNumAvailableBytes()+1; + if (numAvailableBytesFull > kNumOpts-1-cur) + numAvailableBytesFull = kNumOpts-1-cur; + numAvailableBytes = numAvailableBytesFull; + if (numAvailableBytes < 2) + continue; + if (numAvailableBytes > _numFastBytes) + numAvailableBytes = _numFastBytes; + if (numAvailableBytes >= 3 && !nextIsChar) + { + // try Literal + rep0 + int temp; + backOffset = reps[0]+1; + for (temp=1;temp=2) + { + int posStateNext; + unsigned nextRepMatchPrice; + state2 = state; + CState_UpdateChar(state2); + posStateNext = (position+1) & _posStateMask; + nextRepMatchPrice = curAnd1Price + + CMyBitEncoder_GetPrice1(&_isMatch[state2][posStateNext]) + + CMyBitEncoder_GetPrice1(&_isRep[state2]); + while (lenEnd < cur+1+lenTest) + _optimum[++lenEnd].Price = kIfinityPrice; + curAndLenPrice = nextRepMatchPrice + GetRepPrice(0,lenTest,state2,posStateNext); + opt = &_optimum[cur+1+lenTest]; + if (curAndLenPrice < opt->Price) + { + opt->Price = curAndLenPrice; + opt->PosPrev = cur+1; + opt->BackPrev = 0; + opt->Prev1IsChar = true; + opt->Prev2 = false; + } + } + } + for (repIndex=0;repIndexPrice) + { + opt->Price = curAndLenPrice; + opt->PosPrev = cur; + opt->BackPrev = repIndex; + opt->Prev1IsChar = false; + } + } while (--lenTest>=2); + lenTest = lenTestTemp; + lenTest2 = lenTest+1; + limit = lenTest2 + _numFastBytes; + if (limit > numAvailableBytesFull) + limit = numAvailableBytesFull; + for (;lenTest2= 2) + { + unsigned nextMatchPrice,nextRepMatchPrice; + int offset; + state2 = state; + CState_UpdateRep(state2); + posStateNext = (position+lenTest)&_posStateMask; + curAndLenCharPrice = repMatchPrice + GetRepPrice(repIndex,lenTest,state,posState) + + CMyBitEncoder_GetPrice0(&_isMatch[state2][posStateNext]) + + CLiteralEncoder_GetPrice(&_literalEncoder,position+lenTest,data[lenTest-1],true,data[lenTest-backOffset],data[lenTest]); + CState_UpdateChar(state2); + posStateNext = (position+lenTest+1)&_posStateMask; + nextMatchPrice = curAndLenCharPrice + CMyBitEncoder_GetPrice1(&_isMatch[state2][posStateNext]); + nextRepMatchPrice = nextMatchPrice + CMyBitEncoder_GetPrice1(&_isRep[state2]); + offset = lenTest+1+lenTest2; + while (lenEndPrice) + { + opt->Price = curAndLenPrice; + opt->PosPrev = cur+lenTest+1; + opt->BackPrev = 0; + opt->Prev1IsChar = true; + opt->Prev2 = true; + opt->PosPrev2 = cur; + opt->BackPrev2 = repIndex; + } + } + } + if (newLen > numAvailableBytes) + newLen = numAvailableBytes; + if (newLen >= 2) + { + if (newLen==2 && _matchDistances[2] >= 0x80) + continue; + normalMatchPrice = matchPrice + CMyBitEncoder_GetPrice0(&_isRep[state]); + while (lenEnd < cur+newLen) + _optimum[++lenEnd].Price = kIfinityPrice; + for (lenTest=newLen;lenTest>=2;lenTest--) + { + backOffset = _matchDistances[lenTest]; + curAndLenPrice = normalMatchPrice + GetPosLenPrice(backOffset,lenTest,posState); + opt = &_optimum[cur+lenTest]; + if (curAndLenPrice < opt->Price) + { + opt->Price = curAndLenPrice; + opt->PosPrev = cur; + opt->BackPrev = backOffset+kNumRepDistances; + opt->Prev1IsChar = false; + } + if (lenTest==newLen || backOffset!=_matchDistances[lenTest+1]) + { + // Try Match + Literal + Rep0 + backOffset++; + lenTest2 = lenTest+1; + limit = lenTest2+_numFastBytes; + if (limit > numAvailableBytesFull) + limit = numAvailableBytesFull; + for (;lenTest2= 2) + { + state2 = state; + CState_UpdateMatch(state2); + posStateNext = (position+lenTest)&_posStateMask; + curAndLenCharPrice = curAndLenPrice + CMyBitEncoder_GetPrice0(&_isMatch[state2][posStateNext]) + + CLiteralEncoder_GetPrice(&_literalEncoder,position+lenTest,data[lenTest-1],true,data[lenTest-backOffset],data[lenTest]); + CState_UpdateChar(state2); + posStateNext = (position+lenTest+1)&_posStateMask; + nextMatchPrice = curAndLenCharPrice + CMyBitEncoder_GetPrice1(&_isMatch[state2][posStateNext]); + nextRepMatchPrice = nextMatchPrice + CMyBitEncoder_GetPrice1(&_isRep[state2]); + offset = lenTest+1+lenTest2; + while (lenEndPrice) + { + opt->Price = curAndLenPrice; + opt->PosPrev = cur+lenTest+1; + opt->BackPrev = 0; + opt->Prev1IsChar = true; + opt->Prev2 = true; + opt->PosPrev2 = cur; + opt->BackPrev2 = backOffset - 1 + kNumRepDistances; + } + } + } + } + } + } +} + +static bool CodeOneBlock(void) +{ + unsigned posState; + byte curByte,matchByte; + unsigned pos,len,distance,i; + unsigned posSlot,lenToPosState; + CLiteralEncoder2* subCoder; + uint64 progressPosValuePrev; + + if (_finished) + return false; + _finished = true; + progressPosValuePrev = nowPos64; + if (nowPos64 == 0) + { + if (GetNumAvailableBytes() == 0) + { + CEncoder_Flush(); + return false; + } + ReadMatchDistances(); + posState = (unsigned)nowPos64 & _posStateMask; + CMyBitEncoder_Encode(&_isMatch[_state][posState],0); + CState_UpdateChar(_state); + curByte = GetIndexByte(0 - _additionalOffset); + CLiteralEncoder2_Encode( + *CLiteralEncoder_GetSubCoder(&_literalEncoder,(unsigned)nowPos64,_previousByte), + curByte); + _previousByte = curByte; + _additionalOffset--; + nowPos64++; + } + if (GetNumAvailableBytes() == 0) + { + CEncoder_Flush(); + return false; + } + for (;;) + { + posState = (unsigned)nowPos64 & _posStateMask; + GetOptimum((unsigned)nowPos64,&pos,&len); + if (len==1 && pos==0xFFFFFFFF) + { + CMyBitEncoder_Encode(&_isMatch[_state][posState],0); + curByte = GetIndexByte(0-_additionalOffset); + subCoder = CLiteralEncoder_GetSubCoder(&_literalEncoder,(unsigned)nowPos64, + _previousByte); + if (!CState_IsCharState(_state)) + { + matchByte = GetIndexByte(0-_repDistances[0]-1-_additionalOffset); + CLiteralEncoder2_EncodeMatched(*subCoder,matchByte,curByte); + } + else + CLiteralEncoder2_Encode(*subCoder,curByte); + CState_UpdateChar(_state); + _previousByte = curByte; + } + else + { + CMyBitEncoder_Encode(&_isMatch[_state][posState],1); + if (pos < kNumRepDistances) + { + CMyBitEncoder_Encode(&_isRep[_state],1); + if (pos==0) + { + CMyBitEncoder_Encode(&_isRepG0[_state],0); + CMyBitEncoder_Encode(&_isRep0Long[_state][posState], + (len==1) ? 0 : 1); + } + else + { + CMyBitEncoder_Encode(&_isRepG0[_state],1); + if (pos==1) + CMyBitEncoder_Encode(&_isRepG1[_state],0); + else + { + CMyBitEncoder_Encode(&_isRepG1[_state],1); + CMyBitEncoder_Encode(&_isRepG2[_state],pos-2); + } + } + if (len==1) + CState_UpdateShortRep(_state); + else + { + CPriceTableEncoder_Encode(&_repMatchLenEncoder,len-kMatchMinLen,posState); + CState_UpdateRep(_state); + } + distance = _repDistances[pos]; + if (pos) + { + for (i=pos;i;i--) + _repDistances[i] = _repDistances[i-1]; + _repDistances[0] = distance; + } + } + else + { + CMyBitEncoder_Encode(&_isRep[_state],0); + CState_UpdateMatch(_state); + CPriceTableEncoder_Encode(&_lenEncoder,len-kMatchMinLen,posState); + pos -= kNumRepDistances; + posSlot = GetPosSlot(pos); + lenToPosState = GetLenToPosState(len); + CBitTreeEncoder_Encode(&_posSlotEncoder[lenToPosState],posSlot); + if (posSlot >= kStartPosModelIndex) + { + unsigned footerBits; + unsigned base,posReduced; + footerBits = (posSlot>>1)-1; + base = (2 | (posSlot&1)) << footerBits; + posReduced = pos-base; + if (posSlot < kEndPosModelIndex) + ReverseBitTreeEncode(_posEncoders+base-posSlot-1, + footerBits,posReduced); + else + { + RangeEncoder_EncodeDirectBits(posReduced>>kNumAlignBits,footerBits-kNumAlignBits); + CBitTreeEncoder_ReverseEncode(&_posAlignEncoder,posReduced&kAlignMask); + if (--_alignPriceCount == 0) + FillAlignPrices(); + } + } + distance = pos; + for (i=kNumRepDistances-1;i;i--) + _repDistances[i] = _repDistances[i-1]; + _repDistances[0] = distance; + } + _previousByte = GetIndexByte(len-1-_additionalOffset); + } + _additionalOffset -= len; + nowPos64 += len; + if (nowPos64 - lastPosSlotFillingPos >= (1<<9)) + { + FillPosSlotPrices(); + FillDistancesPrices(); + lastPosSlotFillingPos = nowPos64; + } + if (!_additionalOffset) + { + if (GetNumAvailableBytes() == 0) + { + CEncoder_Flush(); + return false; + } + if (nowPos64 - progressPosValuePrev >= (1<<12)) + { + _finished = false; + return true; + } + } + } +} + +extern void __stdcall lzma_set_dict_size( + unsigned logdictsize) +{ + _dictionarySize = 1 << logdictsize; + _distTableSize = logdictsize*2; +} + +extern unsigned __stdcall lzma_compress( + const void* source, + void* destination, + unsigned length, + void* workmem) +{ + FastPosInit(); + //memset(&encoder,0,sizeof(encoder)); + //memset(&rangeEncoder,0,sizeof(rangeEncoder)); + // CEncoder::CEncoder, CEncoder::SetCoderProperties + _numFastBytes = 128; +#ifdef FOR_KERPACK + _posStateBits = 0; + _posStateMask = 0; +#else + _posStateBits = 2; + _posStateMask = 3; +#endif + _numLiteralContextBits = 3; + _numLiteralPosStateBits = 0; + _writeEndMark = false; + // CEncoder::Code - ! + _finished = false; + CEncoder_Create(workmem); + CEncoder_Init(); + FillPosSlotPrices(); + FillDistancesPrices(); + FillAlignPrices(); + CPriceTableEncoder_SetTableSize(&_lenEncoder,_numFastBytes+1-kMatchMinLen); + CPriceTableEncoder_UpdateTables(&_lenEncoder,1<<_posStateBits); + CPriceTableEncoder_SetTableSize(&_repMatchLenEncoder,_numFastBytes+1-kMatchMinLen); + CPriceTableEncoder_UpdateTables(&_repMatchLenEncoder,1<<_posStateBits); + lastPosSlotFillingPos = 0; + nowPos64 = 0; + pack_length = length; + pack_pos = 0; + curin = (const byte*)source; + curout = (byte*)destination; + MatchFinder_Init(); + while (CodeOneBlock()) ; + return curout - (byte*)destination; +} diff --git a/programs/other/kpack/kerpack_linux/lzma_c/LZMAEncoder.h b/programs/other/kpack/kerpack_linux/lzma_c/LZMAEncoder.h new file mode 100644 index 0000000000..3f3fe2970d --- /dev/null +++ b/programs/other/kpack/kerpack_linux/lzma_c/LZMAEncoder.h @@ -0,0 +1,53 @@ +#ifndef _LZMA_ENCODER_H +#define _LZMA_ENCODER_H + +#include "lzma.h" +#include "RangeCoderBitTree.h" + +typedef struct +{ + CState State; + bool Prev1IsChar; + bool Prev2; + unsigned PosPrev2; + unsigned BackPrev2; + unsigned Price; + unsigned PosPrev; + unsigned BackPrev; + unsigned Backs[kNumRepDistances]; +} COptimal; +#define COptimal_MakeAsChar(a) (a)->BackPrev=(unsigned)-1,(a)->Prev1IsChar=false +#define COptimal_MakeAsShortRep(a) (a)->BackPrev=0,(a)->Prev1IsChar=false +#define COptimal_IsShortRep(a) ((a)->BackPrev==0) + +#define kIfinityPrice 0xFFFFFFF +#define kNumOpts (1<<12) + +typedef CMyBitEncoder CLiteralEncoder2[0x300]; +typedef struct +{ + CLiteralEncoder2* _coders; + int _numPrevBits; + int _numPosBits; + unsigned _posMask; +} CLiteralEncoder; + +typedef struct +{ + CMyBitEncoder _choice; + CMyBitEncoder _choice2; + NRangeCoder_CBitTreeEncoder _lowCoder[kNumPosStatesEncodingMax]; + NRangeCoder_CBitTreeEncoder _midCoder[kNumPosStatesEncodingMax]; + NRangeCoder_CBitTreeEncoder _highCoder; +} NLength_CEncoder; + +typedef struct +{ + NLength_CEncoder base; + unsigned _prices[kNumSymbolsTotal][kNumPosStatesEncodingMax]; + unsigned _tableSize; + unsigned _counters[kNumPosStatesEncodingMax]; +} NLength_CPriceTableEncoder; +#define CPriceTableEncoder_Init(a,b) NLength_CEncoder_Init(&a.base,b) + +#endif diff --git a/programs/other/kpack/kerpack_linux/lzma_c/MatchFinder.c b/programs/other/kpack/kerpack_linux/lzma_c/MatchFinder.c new file mode 100644 index 0000000000..88b8ce7bab --- /dev/null +++ b/programs/other/kpack/kerpack_linux/lzma_c/MatchFinder.c @@ -0,0 +1,422 @@ +#include "MatchFinder.h" +/* memcpy must be inlined - we do not want to use RTL */ +#include +/*#pragma function(memcpy) +void* __cdecl memcpy(void* _Dst, const void* _Src, size_t _Size) +{ + unsigned long i; + for (i = 0; i < _Size; i++) + ((char*)_Dst)[i] = ((char*)_Src)[i]; + return _Dst; +}*/ +//#pragma intrinsic(memcpy) + +#define kMaxValForNormalize (((unsigned)1<<31)-1) + +/* settings for bt4: + defined HASH_ARRAY_2 + defined HASH_ARRAY_3 +*/ + +//#define kHash2Size 0x400 +#define kNumHashDirectBytes 0 +#define kNumHashBytes 3 +//#define kHash3Size 0x40000 +#define kHash2Size 0x10000 +#define kHashSize 0x100000 + +#define kHashSizeSum (kHashSize+kHash2Size) +#define kHash2Offset kHashSize + +static unsigned _cyclicBufferPos; +static unsigned _cyclicBufferSize; +static unsigned _matchMaxLen; +static unsigned* _hash; +static unsigned _cutValue; + +#ifdef GENERIC_INPUT +static byte* _bufferBase; +static unsigned _posLimit; +static bool _streamEndWasReached; +static byte* _pointerToLastSafePosition; +static byte* _buffer; +static unsigned _blockSize; +static unsigned _pos; +static unsigned _keepSizeBefore; +static unsigned _keepSizeAfter; +static unsigned _keepSizeReserv; +static unsigned _streamPos; +#else +#define _buffer curin +#define _pos pack_pos +#define _streamPos pack_length +#endif + +#ifdef GENERIC_INPUT +/* LZ Window */ + +static void LZInWindow_Create(unsigned keepSizeBefore,unsigned keepSizeAfter,unsigned keepSizeReserv,byte**mem) +{ + _keepSizeBefore = keepSizeBefore; + _keepSizeAfter = keepSizeAfter; + _keepSizeReserv = keepSizeReserv; + _blockSize = keepSizeBefore + keepSizeAfter + keepSizeReserv; + _bufferBase = *mem; + _blockSize = (_blockSize + 3) & ~3; + *mem += _blockSize; + _pointerToLastSafePosition = _bufferBase + _blockSize - keepSizeAfter; +} + +static void ReadBlock(void) +{ + if (_streamEndWasReached) + return; + for (;;) + { + unsigned size; + size = (unsigned)(_bufferBase-_buffer) + _blockSize - _streamPos; + if (!size) return; + if (size > pack_length - pack_pos) + size = pack_length - pack_pos; + memcpy(_buffer+_streamPos,curin,size); + curin += size; + pack_pos += size; + if (size == 0) + { + byte* pointerToPosition; + _posLimit = _streamPos; + pointerToPosition = _buffer + _posLimit; + if (pointerToPosition > _pointerToLastSafePosition) + _posLimit = _pointerToLastSafePosition - _buffer; + _streamEndWasReached = true; + return; + } + _streamPos += size; + if (_streamPos >= _pos + _keepSizeAfter) + { + _posLimit = _streamPos - _keepSizeAfter; + return; + } + } +} + +static void LZInWindow_Init(void) +{ + _buffer = _bufferBase; + _pos = 0; + _streamPos = 0; + _streamEndWasReached = false; + ReadBlock(); +} +#else +#define LZInWindow_Create(a,b,c,d) /* nothing */ +#define LZInWindow_Init() _buffer--, _pos++, _streamPos++ +#endif + +const byte* GetPointerToCurrentPos(void) {return _buffer+_pos;} + +#ifdef GENERIC_INPUT +static void MoveBlock(void) +{ + unsigned offset,numBytes; + offset = _buffer-_bufferBase+_pos-_keepSizeBefore; + numBytes = _buffer-_bufferBase+_streamPos-offset; + // copying backwards: safe to use memcpy instead of memmove + memcpy(_bufferBase,_bufferBase+offset,numBytes); + _buffer -= offset; +} + +static void LZInWindow_MovePos(void) +{ + _pos++; + if (_pos > _posLimit) + { + const byte* pointerToPosition = _buffer+_pos; + if (pointerToPosition > _pointerToLastSafePosition) + MoveBlock(); + ReadBlock(); + } +} +#else +#define LZInWindow_MovePos() _pos++ +#endif + +byte GetIndexByte(int index) {return _buffer[_pos+index];} + +unsigned GetMatchLen(int index,unsigned distance,unsigned limit) +{ + const byte* pby; + unsigned i; +#ifdef GENERIC_INPUT + if (_streamEndWasReached) + if ((_pos+index)+limit > _streamPos) + limit = _streamPos - (_pos+index); +#else + unsigned limit2 = pack_length - (pack_pos + index); + if (limit > limit2) + limit = limit2; +#endif + distance++; + pby = _buffer + _pos + index; + for (i=0;i>1) ^ 0xEDB88320; + else + r >>= 1; + } + crc_table[i] = r; + } +} + +static unsigned Hash(const byte* ptr, unsigned* hash2Value) +{ + unsigned temp; + temp = crc_table[ptr[0]] ^ ptr[1]; + *hash2Value = *(word*)ptr; //ptr[0] + ((unsigned)ptr[1] << 8); + return (temp ^ ((unsigned)ptr[2]<<8)) & (kHashSize - 1); +} + +unsigned GetLongestMatch(unsigned* distances) +{ + unsigned lenLimit,maxLen=0; + unsigned matchMinPos; + const byte* cur; + unsigned hash2Value,hashValue; + unsigned curMatch,curMatch2; + unsigned *son,*ptr0,*ptr1; + unsigned len0,len1,count; + if (_pos + _matchMaxLen <= _streamPos) + lenLimit = _matchMaxLen; + else + { + lenLimit = _streamPos - _pos; + if (lenLimit < kNumHashBytes) + return 0; + } + matchMinPos = (_pos>_cyclicBufferSize) ? (_pos-_cyclicBufferSize) : 0; + cur = _buffer+_pos; + hashValue = Hash(cur,&hash2Value); + curMatch = _hash[hashValue]; + curMatch2 = _hash[kHash2Offset + hash2Value]; + _hash[kHash2Offset + hash2Value] = _pos; + distances[2] = 0xFFFFFFFF; + if (curMatch2 > matchMinPos) + //if (_buffer[curMatch2] == cur[0]) + { + distances[2] = _pos - curMatch2 - 1; + maxLen = 2; + } + _hash[hashValue] = _pos; + son = _hash + kHashSizeSum; + ptr0 = son + (_cyclicBufferPos << 1) + 1; + ptr1 = son + (_cyclicBufferPos << 1); + distances[kNumHashBytes] = 0xFFFFFFFF; + len0 = len1 = kNumHashDirectBytes; + count = _cutValue; + for (;;) + { + const byte* pb; + unsigned len,delta; + unsigned cyclicPos; + unsigned* pair; + if (curMatch <= matchMinPos || count--==0) + { + *ptr0 = *ptr1 = 0; + break; + } + pb = _buffer+curMatch; + len = (len0 _cyclicBufferSize) ? (_pos - _cyclicBufferSize) : 0; + cur = _buffer+_pos; + hashValue = Hash(cur,&hash2Value); + _hash[kHash2Offset + hash2Value] = _pos; + curMatch = _hash[hashValue]; + _hash[hashValue] = _pos; + son = _hash+kHashSizeSum; + ptr0 = son + (_cyclicBufferPos << 1) + 1; + ptr1 = son + (_cyclicBufferPos << 1); + len0 = len1 = kNumHashDirectBytes; + count = _cutValue; + for (;;) + { + const byte* pb; + unsigned len; + unsigned delta,cyclicPos; + unsigned* pair; + if (curMatch <= matchMinPos || count--==0) + break; + pb = _buffer+curMatch; + len = (len0> kNumMoveReducingBits]; + +void RangeEncoder_Init(void) +{ + int i; + unsigned start,end,j; + low = 0; + range = 0xFFFFFFFF; + _cacheSize = 1; + _cache = 0; + /* init price table */ +#define kNumBits (kNumBitModelTotalBits - kNumMoveReducingBits) + for (i=kNumBits;i--;) + { + start = 1 << (kNumBits - i - 1); + end = 1 << (kNumBits - i); + for (j=start;j> (kNumBits - i - 1)); + } +#undef kNumBits +} + +void RangeEncoder_ShiftLow(void) +{ + if ((unsigned)low < 0xFF000000U || (int)(low>>32)) + { + byte temp = _cache; + do + { + *curout++ = (byte)(temp + (byte)(low>>32)); + temp = 0xFF; + } while (--_cacheSize); + _cache = (byte)((unsigned)low>>24); + } + _cacheSize++; + low = (unsigned)low << 8; +} + +void RangeEncoder_FlushData(void) +{ + int i; + for (i=0;i<5;i++) + RangeEncoder_ShiftLow(); +} + +void RangeEncoder_EncodeDirectBits(unsigned value,int numTotalBits) +{ + int i; + for (i=numTotalBits;i--;) + { + range >>= 1; + if (((value >> i) & 1) == 1) + low += range; + if (range < kTopValue) + { + range <<= 8; + RangeEncoder_ShiftLow(); + } + } +} + +void CMyBitEncoder_Encode(CMyBitEncoder* e,unsigned symbol) +{ + unsigned newBound; + newBound = (range >> kNumBitModelTotalBits) * *e; + if (symbol == 0) + { + range = newBound; + *e += (kBitModelTotal - *e) >> kNumMoveBits; + } + else + { + low += newBound; + range -= newBound; + *e -= *e >> kNumMoveBits; + } + if (range < kTopValue) + { + range <<= 8; + RangeEncoder_ShiftLow(); + } +} + +unsigned CMyBitEncoder_GetPrice(CMyBitEncoder* e, unsigned symbol) +{ + return PriceTable[(((*e-symbol)^((-(int)symbol))) & (kBitModelTotal-1)) >> kNumMoveReducingBits]; +} +unsigned CMyBitEncoder_GetPrice0(CMyBitEncoder* e) +{ + return PriceTable[*e >> kNumMoveReducingBits]; +} +unsigned CMyBitEncoder_GetPrice1(CMyBitEncoder* e) +{ + return PriceTable[(kBitModelTotal - *e) >> kNumMoveReducingBits]; +} + +void CBitTreeEncoder_Init(NRangeCoder_CBitTreeEncoder*e,int numBitLevels) +{ + unsigned i; + e->numBitLevels = numBitLevels; + for (i=1;i<((unsigned)1<Models[i]); +} +void CBitTreeEncoder_Encode(NRangeCoder_CBitTreeEncoder*e,unsigned symbol) +{ + unsigned modelIndex = 1; + int bitIndex; + unsigned bit; + for (bitIndex = e->numBitLevels; bitIndex--;) + { + bit = (symbol >> bitIndex) & 1; + CMyBitEncoder_Encode(&e->Models[modelIndex],bit); + modelIndex = (modelIndex << 1) | bit; + } +} +void CBitTreeEncoder_ReverseEncode(NRangeCoder_CBitTreeEncoder*e,unsigned symbol) +{ + unsigned modelIndex = 1; + int i; + unsigned bit; + for (i=0;inumBitLevels;i++) + { + bit = symbol & 1; + CMyBitEncoder_Encode(&e->Models[modelIndex],bit); + modelIndex = (modelIndex << 1) | bit; + symbol >>= 1; + } +} +unsigned CBitTreeEncoder_GetPrice(NRangeCoder_CBitTreeEncoder*e,unsigned symbol) +{ + unsigned price = 0; + symbol |= (1 << e->numBitLevels); + while (symbol != 1) + { + price += CMyBitEncoder_GetPrice(&e->Models[symbol>>1],symbol&1); + symbol >>= 1; + } + return price; +} +unsigned CBitTreeEncoder_ReverseGetPrice(NRangeCoder_CBitTreeEncoder*e,unsigned symbol) +{ + unsigned price=0; + unsigned modelIndex=1; + int i; + unsigned bit; + for (i=e->numBitLevels;i;i--) + { + bit = symbol&1; + symbol >>= 1; + price += CMyBitEncoder_GetPrice(&e->Models[modelIndex],bit); + modelIndex = (modelIndex<<1)|bit; + } + return price; +} +unsigned ReverseBitTreeGetPrice(CMyBitEncoder*Models,unsigned NumBitLevels,unsigned symbol) +{ + unsigned price=0; + unsigned modelIndex=1; + unsigned bit; + int i; + for (i=NumBitLevels;i;i--) + { + bit = symbol & 1; + symbol >>= 1; + price += CMyBitEncoder_GetPrice(Models+modelIndex,bit); + modelIndex = (modelIndex<<1)|bit; + } + return price; +} +void ReverseBitTreeEncode(CMyBitEncoder*Models,int NumBitLevels,unsigned symbol) +{ + unsigned modelIndex = 1; + int i; + unsigned bit; + for (i=0;i>= 1; + } +} diff --git a/programs/other/kpack/kerpack_linux/lzma_c/RangeCoder.h b/programs/other/kpack/kerpack_linux/lzma_c/RangeCoder.h new file mode 100644 index 0000000000..da9a37787c --- /dev/null +++ b/programs/other/kpack/kerpack_linux/lzma_c/RangeCoder.h @@ -0,0 +1,7 @@ +#include "common.h" +#define kNumTopBits 24 +#define kTopValue (1< +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=lzmapack - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "lzmapack.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "lzmapack.mak" CFG="lzmapack - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "lzmapack - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "lzmapack - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "lzmapack - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O1 /Ob1 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /Zl /FD /c +# ADD BASE RSC /l 0x419 /d "NDEBUG" +# ADD RSC /l 0x419 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "lzmapack - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD BASE RSC /l 0x419 /d "_DEBUG" +# ADD RSC /l 0x419 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ENDIF + +# Begin Target + +# Name "lzmapack - Win32 Release" +# Name "lzmapack - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\LZMAEncoder.c +# End Source File +# Begin Source File + +SOURCE=.\MatchFinder.c +# End Source File +# Begin Source File + +SOURCE=.\RangeCoder.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\common.h +# End Source File +# Begin Source File + +SOURCE=.\lzma.h +# End Source File +# Begin Source File + +SOURCE=.\LZMAEncoder.h +# End Source File +# Begin Source File + +SOURCE=.\MatchFinder.h +# End Source File +# Begin Source File + +SOURCE=.\RangeCoder.h +# End Source File +# Begin Source File + +SOURCE=.\RangeCoderBit.h +# End Source File +# Begin Source File + +SOURCE=.\RangeCoderBitTree.h +# End Source File +# End Group +# End Target +# End Project diff --git a/programs/other/kpack/kerpack_linux/lzma_c/lzmapack.dsw b/programs/other/kpack/kerpack_linux/lzma_c/lzmapack.dsw new file mode 100644 index 0000000000..2fb57ad7f4 --- /dev/null +++ b/programs/other/kpack/kerpack_linux/lzma_c/lzmapack.dsw @@ -0,0 +1,44 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "lzmapack"=.\lzmapack.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "lzmatest"=.\lzmatest\lzmatest.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name lzmapack + End Project Dependency +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/programs/other/kpack/kerpack_linux/lzma_c/lzmatest/lzmatest.dsp b/programs/other/kpack/kerpack_linux/lzma_c/lzmatest/lzmatest.dsp new file mode 100644 index 0000000000..2bf595c7fc --- /dev/null +++ b/programs/other/kpack/kerpack_linux/lzma_c/lzmatest/lzmatest.dsp @@ -0,0 +1,102 @@ +# Microsoft Developer Studio Project File - Name="lzmatest" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=lzmatest - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "lzmatest.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "lzmatest.mak" CFG="lzmatest - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "lzmatest - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "lzmatest - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "lzmatest - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x419 /d "NDEBUG" +# ADD RSC /l 0x419 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib ..\lzmapack.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "lzmatest - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD BASE RSC /l 0x419 /d "_DEBUG" +# ADD RSC /l 0x419 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib ..\lzmapack.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "lzmatest - Win32 Release" +# Name "lzmatest - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\main.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/programs/other/kpack/kerpack_linux/lzma_c/lzmatest/main.cpp b/programs/other/kpack/kerpack_linux/lzma_c/lzmatest/main.cpp new file mode 100644 index 0000000000..7de457eb59 --- /dev/null +++ b/programs/other/kpack/kerpack_linux/lzma_c/lzmatest/main.cpp @@ -0,0 +1,31 @@ +#include +#include +extern "C" __stdcall lzma_set_dict_size(unsigned logdictsize); +extern "C" __stdcall lzma_compress( + const void* source, + void* destination, + unsigned length, + void* workmem); + +int main() +{ + FILE* f; + f = fopen("test.in","rb"); + fseek(f,0,SEEK_END); + unsigned inlen = ftell(f); + fseek(f,0,SEEK_SET); + void* in = VirtualAlloc(NULL,inlen,MEM_COMMIT,PAGE_READWRITE); + void* out = VirtualAlloc(NULL,inlen,MEM_COMMIT,PAGE_READWRITE); + fread(in,1,inlen,f); + fclose(f); + unsigned logdictsize,dictsize; + for (logdictsize=0,dictsize=1;dictsize %d\n",inlen,outlen); + f = fopen("test.out","wb"); + fwrite(out,1,outlen,f); + fclose(f); + return 0; +} diff --git a/programs/other/kpack/kerpack_linux/lzma_c/readme.txt b/programs/other/kpack/kerpack_linux/lzma_c/readme.txt new file mode 100644 index 0000000000..aa035ed5fc --- /dev/null +++ b/programs/other/kpack/kerpack_linux/lzma_c/readme.txt @@ -0,0 +1,44 @@ + C , diamond', +LZMA-. LZMA SDK 4.32 copyright (c) 1999-2005 +Igor Pavlov, http://www.7-zip.org/sdk.html, +, , C++,C# Java +, LZMA- ANSI-C, 7z. + + , +bt4 match-finder, (, + ), + . ( LZMA +SDK.) , + VC++, ANSI C + VC- #pragma intrinsic(memcpy), , + memcpy - + C run-time library. ( , + MtApPack, +RTL Windows, Kolibri.) + + , LZMA SDK, + ( ) GNU LGPL +GNU CPL. ( SDK + + , .) + + : C++- : +extern "C" __stdcall void lzma_set_dict_size(unsigned logdictsize); +extern "C" __stdcall unsigned lzma_compress( + const void* source, + void* destination, + unsigned length, + void* workmem); + + , + 2 +(.. dictsize == (1< lang.inc", {"lang.inc"}) +tup.rule({"t_edit.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "t_edit") diff --git a/programs/other/t_edit/info/Tupfile.lua b/programs/other/t_edit/info/Tupfile.lua new file mode 100644 index 0000000000..88cec6e826 --- /dev/null +++ b/programs/other/t_edit/info/Tupfile.lua @@ -0,0 +1,4 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +for i,v in ipairs{"asm", "cpp_kol_cla", "cpp_kol_dar", "cpp_kol_def", "default", "html", "ini_files", "voc_eng_rus", "win_const"} do + tup.rule(v .. "_syn.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), v .. ".syn") +end diff --git a/programs/other/t_edit_synt/Tupfile.lua b/programs/other/t_edit_synt/Tupfile.lua new file mode 100644 index 0000000000..cef73e02fa --- /dev/null +++ b/programs/other/t_edit_synt/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("te_syntax.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "te_syntax") diff --git a/programs/other/table/Tupfile.lua b/programs/other/table/Tupfile.lua new file mode 100644 index 0000000000..c90c655938 --- /dev/null +++ b/programs/other/table/Tupfile.lua @@ -0,0 +1,5 @@ +if tup.getconfig("NO_MSVC") ~= "" then return end +HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR") +tup.include(HELPERDIR .. "/use_msvc.lua") +compile_msvc{"*.cpp"} +link_msvc("table") diff --git a/programs/other/table/math2.cpp b/programs/other/table/math2.cpp index f31a5b75a1..dead28c58f 100644 --- a/programs/other/table/math2.cpp +++ b/programs/other/table/math2.cpp @@ -43,6 +43,7 @@ extern "C" double _ftol(double x) } } #endif +#pragma function(ceil) double __cdecl ceil(double x) { __asm { diff --git a/programs/system/MyKey/trunk/Tupfile.lua b/programs/system/MyKey/trunk/Tupfile.lua new file mode 100644 index 0000000000..c883f468b3 --- /dev/null +++ b/programs/system/MyKey/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"MyKey.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "MyKey") diff --git a/programs/system/RunOD/Tupfile.lua b/programs/system/RunOD/Tupfile.lua new file mode 100644 index 0000000000..d1326b344f --- /dev/null +++ b/programs/system/RunOD/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"RunOD.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "RunOD") diff --git a/programs/system/apm/Tupfile.lua b/programs/system/apm/Tupfile.lua new file mode 100644 index 0000000000..f70da88e8f --- /dev/null +++ b/programs/system/apm/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("apm.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "apm") diff --git a/programs/system/battery/Tupfile.lua b/programs/system/battery/Tupfile.lua new file mode 100644 index 0000000000..acf10ad026 --- /dev/null +++ b/programs/system/battery/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("bi.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "bi") diff --git a/programs/system/beep/Tupfile.lua b/programs/system/beep/Tupfile.lua new file mode 100644 index 0000000000..0b03d3b8f9 --- /dev/null +++ b/programs/system/beep/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("beep.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "beep") diff --git a/programs/system/board/trunk/Tupfile.lua b/programs/system/board/trunk/Tupfile.lua new file mode 100644 index 0000000000..e9f286fdaf --- /dev/null +++ b/programs/system/board/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"board.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "board") diff --git a/programs/system/calendar/trunk/Tupfile.lua b/programs/system/calendar/trunk/Tupfile.lua new file mode 100644 index 0000000000..fe888ee258 --- /dev/null +++ b/programs/system/calendar/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"calendar.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "calendar") diff --git a/programs/system/cd_tray/Tupfile.lua b/programs/system/cd_tray/Tupfile.lua new file mode 100644 index 0000000000..d1bf6e78fb --- /dev/null +++ b/programs/system/cd_tray/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"CD_tray.ASM", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "CD_tray") diff --git a/programs/system/clip/trunk/Tupfile.lua b/programs/system/clip/trunk/Tupfile.lua new file mode 100644 index 0000000000..90bdbe3fb9 --- /dev/null +++ b/programs/system/clip/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.foreach_rule({"@clip.ASM", "cliptest.ASM", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "%B") diff --git a/programs/system/colrdial/Tupfile.lua b/programs/system/colrdial/Tupfile.lua new file mode 100644 index 0000000000..223767202c --- /dev/null +++ b/programs/system/colrdial/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("color_dialog.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "color_dialog") diff --git a/programs/system/cpu/trunk/Tupfile.lua b/programs/system/cpu/trunk/Tupfile.lua new file mode 100644 index 0000000000..8c8a4fd4c1 --- /dev/null +++ b/programs/system/cpu/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"cpu.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "cpu") diff --git a/programs/system/cpuid/trunk/Tupfile.lua b/programs/system/cpuid/trunk/Tupfile.lua new file mode 100644 index 0000000000..be63e97799 --- /dev/null +++ b/programs/system/cpuid/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"CPUID.ASM", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "CPUID") diff --git a/programs/system/cropflat/Tupfile.lua b/programs/system/cropflat/Tupfile.lua new file mode 100644 index 0000000000..16b03b0ce4 --- /dev/null +++ b/programs/system/cropflat/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("cropflat.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "cropflat") diff --git a/programs/system/deskcfg/Tupfile.lua b/programs/system/deskcfg/Tupfile.lua new file mode 100644 index 0000000000..e99f898bb4 --- /dev/null +++ b/programs/system/deskcfg/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("deskcfg.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "deskcfg") diff --git a/programs/system/desktop/trunk/Tupfile.lua b/programs/system/desktop/trunk/Tupfile.lua new file mode 100644 index 0000000000..4f82077286 --- /dev/null +++ b/programs/system/desktop/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"desktop.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "desktop") diff --git a/programs/system/disptest/trunk/Tupfile.lua b/programs/system/disptest/trunk/Tupfile.lua new file mode 100644 index 0000000000..a5e379a122 --- /dev/null +++ b/programs/system/disptest/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"disptest.ASM", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "disptest") diff --git a/programs/system/docky/trunk/Tupfile.lua b/programs/system/docky/trunk/Tupfile.lua new file mode 100644 index 0000000000..91823d46de --- /dev/null +++ b/programs/system/docky/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("docky.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "docky") diff --git a/programs/system/docpack/trunk/Tupfile.lua b/programs/system/docpack/trunk/Tupfile.lua new file mode 100644 index 0000000000..a26abf1007 --- /dev/null +++ b/programs/system/docpack/trunk/Tupfile.lua @@ -0,0 +1,17 @@ +if tup.getconfig("NO_FASM") ~= "" or tup.getconfig("BUILD_TYPE") == "" then return end +deps = tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +DOCDIR = "../../../../data/" .. tup.getconfig("BUILD_TYPE") .. "/docs/" +if tup.getconfig("TUP_PLATFORM") == "win32" +then env_prefix = "set DOCDIR=$(DOCDIR)&&"; cp_cmd = "copy %f %o" +else env_prefix = "DOCDIR=$(DOCDIR) "; cp_cmd = "cp %f %o" +end +if tup.getconfig("LANG") == "ru" +then tup.append_table(deps, + tup.rule("../../../../kernel/trunk/docs/sysfuncr.txt", "iconv -f utf-8 -t cp866 %f > %o", "SYSFUNCR.TXT")) +else tup.append_table(deps, + tup.rule("../../../../kernel/trunk/docs/sysfuncs.txt", cp_cmd, "SYSFUNCS.TXT")) +end +tup.append_table(deps, + tup.rule("../../../develop/fasm/trunk/fasm.txt", cp_cmd, "FASM.TXT") +) +tup.rule({"docpack.asm", extra_inputs = deps}, env_prefix .. "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "docpack") diff --git a/programs/system/docpack/trunk/docpack.asm b/programs/system/docpack/trunk/docpack.asm index b50b1924aa..b1ec9629ec 100755 --- a/programs/system/docpack/trunk/docpack.asm +++ b/programs/system/docpack/trunk/docpack.asm @@ -8,7 +8,7 @@ FILE_COUNT=0 DEF_FILE equ 'g' -macro embed_file fn +macro embed_docdir_file fn { forward local label,label2,label3 @@ -21,6 +21,19 @@ macro embed_file fn label2: FILE_COUNT=FILE_COUNT+1 } +macro embed_local_file fn +{ + forward + local label,label2,label3 + dd label2-label + dd label-label3 + label3: + db fn + label: + file fn + label2: + FILE_COUNT=FILE_COUNT+1 +} use32 org 0x0 @@ -172,24 +185,24 @@ embedded: ; Please use only filenames w/o path! ; -- Start of embedding area ------ - embed_file 'README.TXT' ;a + embed_docdir_file 'README.TXT' ;a if lang eq ru - embed_file 'GNU.TXT' ;b + embed_docdir_file 'GNU.TXT' ;b else - embed_file 'COPYING.TXT' ;b + embed_docdir_file 'COPYING.TXT' ;b end if - embed_file 'HOT_KEYS.TXT' ;c - embed_file 'FASM.TXT' ;d - embed_file 'MTDBG.TXT' ;e + embed_docdir_file 'HOT_KEYS.TXT' ;c + embed_local_file 'FASM.TXT' ;d + embed_docdir_file 'MTDBG.TXT' ;e if lang eq ru - embed_file 'SYSFUNCR.TXT' ;f + embed_local_file 'SYSFUNCR.TXT' ;f else - embed_file 'SYSFUNCS.TXT' ;f + embed_local_file 'SYSFUNCS.TXT' ;f end if - embed_file 'STACK.TXT' ;g - embed_file 'KFAR_KEYS.TXT' ;h - embed_file 'INI.TXT' ;i - embed_file 'OPENDIAL.TXT' ;j + embed_docdir_file 'STACK.TXT' ;g + embed_docdir_file 'KFAR_KEYS.TXT' ;h + embed_docdir_file 'INI.TXT' ;i + embed_docdir_file 'OPENDIAL.TXT' ;j ; -- End of embedding area ------- dd 0 diff --git a/programs/system/end/light/Tupfile.lua b/programs/system/end/light/Tupfile.lua new file mode 100644 index 0000000000..ec365610d4 --- /dev/null +++ b/programs/system/end/light/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"end.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "end") diff --git a/programs/system/end/trunk/Tupfile.lua b/programs/system/end/trunk/Tupfile.lua new file mode 100644 index 0000000000..0adda22b8e --- /dev/null +++ b/programs/system/end/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("end.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "end") diff --git a/programs/system/gmon/Tupfile.lua b/programs/system/gmon/Tupfile.lua new file mode 100644 index 0000000000..1ec971814a --- /dev/null +++ b/programs/system/gmon/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"gmon.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "gmon") diff --git a/programs/system/hdd_info/trunk/Tupfile.lua b/programs/system/hdd_info/trunk/Tupfile.lua new file mode 100644 index 0000000000..252fbb19c0 --- /dev/null +++ b/programs/system/hdd_info/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"hdd_info.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "hdd_info") diff --git a/programs/system/icon/trunk/Tupfile.lua b/programs/system/icon/trunk/Tupfile.lua new file mode 100644 index 0000000000..c47a3460c9 --- /dev/null +++ b/programs/system/icon/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"icon.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "icon") diff --git a/programs/system/icon_new/Tupfile.lua b/programs/system/icon_new/Tupfile.lua new file mode 100644 index 0000000000..2a68f5fee6 --- /dev/null +++ b/programs/system/icon_new/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"@icon.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "@icon") diff --git a/programs/system/kbd/trunk/Tupfile.lua b/programs/system/kbd/trunk/Tupfile.lua new file mode 100644 index 0000000000..08bef6e27f --- /dev/null +++ b/programs/system/kbd/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"kbd.ASM", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "kbd") diff --git a/programs/system/keybi/Tupfile.lua b/programs/system/keybi/Tupfile.lua new file mode 100644 index 0000000000..bad5d4fbb5 --- /dev/null +++ b/programs/system/keybi/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"keybi.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "keybi") diff --git a/programs/system/latency/trunk/Tupfile.lua b/programs/system/latency/trunk/Tupfile.lua new file mode 100644 index 0000000000..5947a8b17c --- /dev/null +++ b/programs/system/latency/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("latency.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "latency") diff --git a/programs/system/launcher/trunk/Tupfile.lua b/programs/system/launcher/trunk/Tupfile.lua new file mode 100644 index 0000000000..9596181bec --- /dev/null +++ b/programs/system/launcher/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("launcher.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "launcher") diff --git a/programs/system/loaddrv/Tupfile.lua b/programs/system/loaddrv/Tupfile.lua new file mode 100644 index 0000000000..0e0953493a --- /dev/null +++ b/programs/system/loaddrv/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("loaddrv.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "loaddrv") diff --git a/programs/system/menu/trunk/Tupfile.lua b/programs/system/menu/trunk/Tupfile.lua new file mode 100644 index 0000000000..b282f7cd34 --- /dev/null +++ b/programs/system/menu/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"menu.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "menu") diff --git a/programs/system/mgb/trunk/Tupfile.lua b/programs/system/mgb/trunk/Tupfile.lua new file mode 100644 index 0000000000..b9d1c002fa --- /dev/null +++ b/programs/system/mgb/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"mgb.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "mgb") diff --git a/programs/system/mousemul/trunk/Tupfile.lua b/programs/system/mousemul/trunk/Tupfile.lua new file mode 100644 index 0000000000..7bf515f510 --- /dev/null +++ b/programs/system/mousemul/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"mousemul.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "mousemul") diff --git a/programs/system/notify3/Tupfile.lua b/programs/system/notify3/Tupfile.lua new file mode 100644 index 0000000000..e1e5d87b63 --- /dev/null +++ b/programs/system/notify3/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("notify.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "notify") diff --git a/programs/system/panel/trunk/Tupfile.lua b/programs/system/panel/trunk/Tupfile.lua new file mode 100644 index 0000000000..3dc17460c5 --- /dev/null +++ b/programs/system/panel/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"@PANEL.ASM", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "@PANEL") diff --git a/programs/system/pcidev/branches/new_api/Tupfile.lua b/programs/system/pcidev/branches/new_api/Tupfile.lua new file mode 100644 index 0000000000..6bcac688ad --- /dev/null +++ b/programs/system/pcidev/branches/new_api/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"PCIDEV.ASM", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "PCIDEV") diff --git a/programs/system/pcidev/trunk/Tupfile.lua b/programs/system/pcidev/trunk/Tupfile.lua new file mode 100644 index 0000000000..6bcac688ad --- /dev/null +++ b/programs/system/pcidev/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"PCIDEV.ASM", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "PCIDEV") diff --git a/programs/system/psxpad/Tupfile.lua b/programs/system/psxpad/Tupfile.lua new file mode 100644 index 0000000000..3d9d4c2141 --- /dev/null +++ b/programs/system/psxpad/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("psxpad.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "psxpad") diff --git a/programs/system/rb/trunk/Tupfile.lua b/programs/system/rb/trunk/Tupfile.lua new file mode 100644 index 0000000000..31b80adc17 --- /dev/null +++ b/programs/system/rb/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"@RB.ASM", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "@RB") diff --git a/programs/system/rdsave/trunk/Tupfile.lua b/programs/system/rdsave/trunk/Tupfile.lua new file mode 100644 index 0000000000..12d5173042 --- /dev/null +++ b/programs/system/rdsave/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"rdsave.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "rdsave") diff --git a/programs/system/refrscrn/Tupfile.lua b/programs/system/refrscrn/Tupfile.lua new file mode 100644 index 0000000000..1079d45e96 --- /dev/null +++ b/programs/system/refrscrn/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"refrscrn.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "refrscrn") diff --git a/programs/system/run/trunk/Tupfile.lua b/programs/system/run/trunk/Tupfile.lua new file mode 100644 index 0000000000..ec2bf29dd5 --- /dev/null +++ b/programs/system/run/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"run.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "run") diff --git a/programs/system/searchap/Tupfile.lua b/programs/system/searchap/Tupfile.lua new file mode 100644 index 0000000000..344ee5403d --- /dev/null +++ b/programs/system/searchap/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("searchap.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "searchap") diff --git a/programs/system/setup/trunk/Tupfile.lua b/programs/system/setup/trunk/Tupfile.lua new file mode 100644 index 0000000000..c58b95d034 --- /dev/null +++ b/programs/system/setup/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("setup.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "setup") diff --git a/programs/system/shell/Tupfile.lua b/programs/system/shell/Tupfile.lua new file mode 100644 index 0000000000..fee62b43b3 --- /dev/null +++ b/programs/system/shell/Tupfile.lua @@ -0,0 +1,26 @@ +if tup.getconfig("NO_FASM") ~= "" or tup.getconfig("NO_GCC") ~= "" then return end +HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR") +tup.include(HELPERDIR .. "/use_gcc.lua") +LDFLAGS = LDFLAGS .. " -T kolibri.ld" +-- compile shell +if tup.getconfig("LANG") == "ru" +then C_LANG = "LANG_RUS" +else C_LANG = "LANG_ENG" -- this includes default case without config +end + +if tup.getconfig("TUP_PLATFORM") == "win32" +-- on win32 '#' is not a special character, but backslash and quotes would be printed as is +then tup.rule('echo #define ' .. C_LANG .. ' 1 > %o', {"lang.h"}) +-- on unix '#' should be escaped +else tup.rule('echo "#define" ' .. C_LANG .. ' 1 > %o', {"lang.h"}) +end +tup.append_table(OBJS, tup.rule("start.asm", "fasm %f %o", "start.o")) +compile_gcc{"shell.c", "system/kolibri.c", "system/stdlib.c", "system/string.c", "system/ctype.c", extra_inputs = {"lang.h"}} +link_gcc("shell") + +-- compile ASM test +tup.rule("test.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "asmtest") +-- compile C test +OBJS = {"start.o", "kolibri.o", "stdlib.o", "string.o", "ctype.o"} -- remove shell.o +compile_gcc{"test.c"} +link_gcc("ctest") diff --git a/programs/system/skinsel/Tupfile.lua b/programs/system/skinsel/Tupfile.lua new file mode 100644 index 0000000000..d3fbefa481 --- /dev/null +++ b/programs/system/skinsel/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("skinsel.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "skinsel") diff --git a/programs/system/ss/trunk/Tupfile.lua b/programs/system/ss/trunk/Tupfile.lua new file mode 100644 index 0000000000..a340291389 --- /dev/null +++ b/programs/system/ss/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"@ss.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "@ss") diff --git a/programs/system/terminal/Tupfile.lua b/programs/system/terminal/Tupfile.lua new file mode 100644 index 0000000000..44003e9e2d --- /dev/null +++ b/programs/system/terminal/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("terminal.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "terminal") diff --git a/programs/system/test/trunk/Tupfile.lua b/programs/system/test/trunk/Tupfile.lua new file mode 100644 index 0000000000..e9d5fb35e5 --- /dev/null +++ b/programs/system/test/trunk/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"}) +tup.rule({"test.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "test") diff --git a/programs/system/tinfo/Tupfile.lua b/programs/system/tinfo/Tupfile.lua new file mode 100644 index 0000000000..d582246bc7 --- /dev/null +++ b/programs/system/tinfo/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_NASM") ~= "" then return end +tup.rule("tinfo.asm", "nasm -f bin -o %o %f " .. tup.getconfig("KPACK_CMD"), "tinfo") diff --git a/programs/system/zkey/trunk/Tupfile.lua b/programs/system/zkey/trunk/Tupfile.lua new file mode 100644 index 0000000000..e1bb41828a --- /dev/null +++ b/programs/system/zkey/trunk/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("ZKEY.ASM", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "ZKEY") diff --git a/programs/use_gcc.lua b/programs/use_gcc.lua new file mode 100644 index 0000000000..50ff511b83 --- /dev/null +++ b/programs/use_gcc.lua @@ -0,0 +1,30 @@ +CFLAGS = "-Os -fno-ident -fomit-frame-pointer -fno-stack-check -fno-stack-protector -mno-stack-arg-probe -mpreferred-stack-boundary=2 -fno-exceptions -fno-asynchronous-unwind-tables -ffast-math" +LDFLAGS = "-nostdlib -n --file-alignment=16 --section-alignment=16" +INCLUDES = "" +LIBS = "" +LIBDEPS = {} +OBJS = {} + +function compile_gcc(input, output) + if not output then output = '%B.o' end + tup.append_table(OBJS, + tup.foreach_rule(input, "kos32-gcc -c " .. CFLAGS .. " " .. INCLUDES .. " -o %o %f", output) + ) +end + +function link_gcc(input, output) + if not output then input,output = OBJS,input end + if tup.getconfig("HELPERDIR") == "" and #LIBDEPS then + if type(input) == "string" then input = {input} end + if not input.extra_inputs then input.extra_inputs = {} end + tup.append_table(input.extra_inputs, LIBDEPS) + end + + if type(output) == "string" then output = {output} end + if not output.extra_outputs then output.extra_outputs = {} end + table.insert(output.extra_outputs, output[1] .. ".map") + + tup.rule(input, + "kos32-ld " .. LDFLAGS .. " -o %o %f -Map %o.map " .. LIBS .. " && kos32-objcopy %o -O binary " .. tup.getconfig("KPACK_CMD"), + output) +end diff --git a/programs/use_menuetlibc.lua b/programs/use_menuetlibc.lua new file mode 100644 index 0000000000..4a66750961 --- /dev/null +++ b/programs/use_menuetlibc.lua @@ -0,0 +1,6 @@ +MELIBC = tup.getcwd() .. "/develop/libraries/menuetlibc" + +INCLUDES = INCLUDES .. " -I" .. MELIBC .. "/include" +LDFLAGS = LDFLAGS .. string.gsub(" -T$/include/scripts/menuetos_app_v01.ld -L$/lib $/stub/crt0.o", "%$", MELIBC) +tup.append_table(LIBDEPS, {MELIBC .. "/stub/crt0.o", MELIBC .. "/", MELIBC .. "/", MELIBC .. "/"}) +LIBS = LIBS .. " -lcpp -lm -lc" diff --git a/programs/use_msvc.lua b/programs/use_msvc.lua new file mode 100644 index 0000000000..96f5c7bbae --- /dev/null +++ b/programs/use_msvc.lua @@ -0,0 +1,28 @@ +CFLAGS = "/O2 /Os /Oy /GF /GS- /GR- /EHs-c- /fp:fast /GL /QIfist /Gr /arch:IA32 /DAUTOBUILD" +LDFLAGS = "/section:.bss,E /fixed:no /subsystem:native /merge:.data=.text /merge:.rdata=.text /merge:.1seg=.text /entry:crtStartUp /ltcg /nodefaultlib" + +THISDIR = tup.getcwd() -- here it points to use_msvc.lua, inside rules it would be just "." +OBJS = {} + +function compile_msvc(input, output) + if not output then output = '%B.obj' end + tup.append_table(OBJS, + tup.foreach_rule(input, "cl /c " .. CFLAGS .. " /Fo%o %f >&2", output) + ) +end + +if tup.getconfig("TUP_PLATFORM") == "win32" +then env_prefix = "set EXENAME=%f&&" -- note that there should be no space between value and "&&" +else env_prefix = "EXENAME=%f " +end + +function link_msvc(input, output) + if not output then input,output = OBJS,input end + + if type(output) ~= "string" then error("output for link_msvc should be simple string") end + local exename = output .. ".exe" + local mapname = output .. ".map" + + tup.rule(input, "link.exe " .. LDFLAGS .. " /out:%o /Map:" .. mapname .. " %f", {exename, extra_outputs = {mapname}}) + tup.rule(exename, env_prefix .. "fasm " .. THISDIR .. "/../data/eng/doexe2.asm %o " .. tup.getconfig("KPACK_CMD"), output) +end diff --git a/programs/use_tinygl.lua b/programs/use_tinygl.lua new file mode 100644 index 0000000000..3542e18abb --- /dev/null +++ b/programs/use_tinygl.lua @@ -0,0 +1,5 @@ +TINYGL = tup.getcwd() .. "/develop/libraries/TinyGL" + +INCLUDES = INCLUDES .. " -I" .. TINYGL .. "/include" +table.insert(LIBDEPS, TINYGL .. "/<>") +LIBS = TINYGL .. "/lib/libTinyGL.a " .. LIBS diff --git a/skins/_old/5imple Alpha/1.5imple Alpha/Tupfile.lua b/skins/_old/5imple Alpha/1.5imple Alpha/Tupfile.lua new file mode 100644 index 0000000000..ad47d4d59c --- /dev/null +++ b/skins/_old/5imple Alpha/1.5imple Alpha/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("1.5imple_Alpha.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "1.5imple Alpha.skn") diff --git a/skins/_old/5imple Alpha/2.5imple Alpha/Tupfile.lua b/skins/_old/5imple Alpha/2.5imple Alpha/Tupfile.lua new file mode 100644 index 0000000000..e71b149c04 --- /dev/null +++ b/skins/_old/5imple Alpha/2.5imple Alpha/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("2.5imple_Alpha.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "2.5imple Alpha.skn") diff --git a/skins/_old/5imple Alpha/3.5imple Alpha/Tupfile.lua b/skins/_old/5imple Alpha/3.5imple Alpha/Tupfile.lua new file mode 100644 index 0000000000..b5e0927750 --- /dev/null +++ b/skins/_old/5imple Alpha/3.5imple Alpha/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("3.5imple_Alpha.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "3.5imple Alpha.skn") diff --git a/skins/_old/Arena/Tupfile.lua b/skins/_old/Arena/Tupfile.lua new file mode 100644 index 0000000000..50c238925d --- /dev/null +++ b/skins/_old/Arena/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Arena.skn") diff --git a/skins/_old/Black_lace/1.Black_lace/Tupfile.lua b/skins/_old/Black_lace/1.Black_lace/Tupfile.lua new file mode 100644 index 0000000000..345005e180 --- /dev/null +++ b/skins/_old/Black_lace/1.Black_lace/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("1.Black_lace.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "1.Black_lace.skn") diff --git a/skins/_old/Black_lace/2.Black_lace/Tupfile.lua b/skins/_old/Black_lace/2.Black_lace/Tupfile.lua new file mode 100644 index 0000000000..0deb6ac91e --- /dev/null +++ b/skins/_old/Black_lace/2.Black_lace/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("2.Black_lace.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "2.Black_lace.skn") diff --git a/skins/_old/Blended/Tupfile.lua b/skins/_old/Blended/Tupfile.lua new file mode 100644 index 0000000000..2d9c9dd1b9 --- /dev/null +++ b/skins/_old/Blended/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Blended.skn") diff --git a/skins/_old/Blended/default.skn b/skins/_old/Blended/default.skn deleted file mode 100644 index 299f3a9ae5..0000000000 Binary files a/skins/_old/Blended/default.skn and /dev/null differ diff --git a/skins/_old/Brick/1.Brick/Tupfile.lua b/skins/_old/Brick/1.Brick/Tupfile.lua new file mode 100644 index 0000000000..907f185a18 --- /dev/null +++ b/skins/_old/Brick/1.Brick/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("brick.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "1.Brick.skn") diff --git a/skins/_old/BrownLustre/BrownLustre/Tupfile.lua b/skins/_old/BrownLustre/BrownLustre/Tupfile.lua new file mode 100644 index 0000000000..04de66d54d --- /dev/null +++ b/skins/_old/BrownLustre/BrownLustre/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("BrownLustre.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "BrownLustre.skn") diff --git a/skins/_old/BrownLustre/BrownLustre_2/Tupfile.lua b/skins/_old/BrownLustre/BrownLustre_2/Tupfile.lua new file mode 100644 index 0000000000..1ac49c2560 --- /dev/null +++ b/skins/_old/BrownLustre/BrownLustre_2/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("BrownLustre_2.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "BrownLustre_2.skn") diff --git a/skins/_old/Circles/1.Circles/Tupfile.lua b/skins/_old/Circles/1.Circles/Tupfile.lua new file mode 100644 index 0000000000..2305a46491 --- /dev/null +++ b/skins/_old/Circles/1.Circles/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("1.Circles.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "1.Circles.skn") diff --git a/skins/_old/Circles/2.Circles/Tupfile.lua b/skins/_old/Circles/2.Circles/Tupfile.lua new file mode 100644 index 0000000000..ce94842a3a --- /dev/null +++ b/skins/_old/Circles/2.Circles/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("2.Circles.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "2.Circles.skn") diff --git a/skins/_old/Circles/3.Circles/Tupfile.lua b/skins/_old/Circles/3.Circles/Tupfile.lua new file mode 100644 index 0000000000..93f6267c03 --- /dev/null +++ b/skins/_old/Circles/3.Circles/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("3.Circles.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "3.Circles.skn") diff --git a/skins/_old/Circles/4.Circles/Tupfile.lua b/skins/_old/Circles/4.Circles/Tupfile.lua new file mode 100644 index 0000000000..e71b79a515 --- /dev/null +++ b/skins/_old/Circles/4.Circles/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("4.Circles.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "4.Circles.skn") diff --git a/skins/_old/CodeOpusC/Opus_A/Tupfile.lua b/skins/_old/CodeOpusC/Opus_A/Tupfile.lua new file mode 100644 index 0000000000..c8794e5e82 --- /dev/null +++ b/skins/_old/CodeOpusC/Opus_A/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Opus_A.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Opus_A.skn") diff --git a/skins/_old/CodeOpusC/Opus_B/Tupfile.lua b/skins/_old/CodeOpusC/Opus_B/Tupfile.lua new file mode 100644 index 0000000000..9c68cbc8f2 --- /dev/null +++ b/skins/_old/CodeOpusC/Opus_B/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Opus_B.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Opus_B.skn") diff --git a/skins/_old/CodeOpusC/Opus_D/Tupfile.lua b/skins/_old/CodeOpusC/Opus_D/Tupfile.lua new file mode 100644 index 0000000000..4ec88d2b02 --- /dev/null +++ b/skins/_old/CodeOpusC/Opus_D/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Opus_D.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Opus_D.skn") diff --git a/skins/_old/CodeOpusC/Opus_DA/Tupfile.lua b/skins/_old/CodeOpusC/Opus_DA/Tupfile.lua new file mode 100644 index 0000000000..8389851f18 --- /dev/null +++ b/skins/_old/CodeOpusC/Opus_DA/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Opus_DA.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Opus_DA.skn") diff --git a/skins/_old/CodeOpusC/Opus_G/Tupfile.lua b/skins/_old/CodeOpusC/Opus_G/Tupfile.lua new file mode 100644 index 0000000000..4ce9cfb46b --- /dev/null +++ b/skins/_old/CodeOpusC/Opus_G/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Opus_G.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Opus_G.skn") diff --git a/skins/_old/Crystal/Tupfile.lua b/skins/_old/Crystal/Tupfile.lua new file mode 100644 index 0000000000..cc8a2fb34f --- /dev/null +++ b/skins/_old/Crystal/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Crystal.skn") diff --git a/skins/_old/Crystal/default.skn b/skins/_old/Crystal/default.skn deleted file mode 100644 index 04aa243fea..0000000000 Binary files a/skins/_old/Crystal/default.skn and /dev/null differ diff --git a/skins/_old/Cyclops/1.Cyclops/Tupfile.lua b/skins/_old/Cyclops/1.Cyclops/Tupfile.lua new file mode 100644 index 0000000000..5ab42882e9 --- /dev/null +++ b/skins/_old/Cyclops/1.Cyclops/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("1.Cyclops.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "1.Cyclops.skn") diff --git a/skins/_old/Cyclops/2.Cyclops/Tupfile.lua b/skins/_old/Cyclops/2.Cyclops/Tupfile.lua new file mode 100644 index 0000000000..b47774f557 --- /dev/null +++ b/skins/_old/Cyclops/2.Cyclops/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("2.Cyclops.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "2.Cyclops.skn") diff --git a/skins/_old/Dark_future/Tupfile.lua b/skins/_old/Dark_future/Tupfile.lua new file mode 100644 index 0000000000..f573177b6e --- /dev/null +++ b/skins/_old/Dark_future/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Dark_future.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Dark_future.skn") diff --git a/skins/_old/Devil_skins/Blue_devil/Tupfile.lua b/skins/_old/Devil_skins/Blue_devil/Tupfile.lua new file mode 100644 index 0000000000..5f4626241f --- /dev/null +++ b/skins/_old/Devil_skins/Blue_devil/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Blue_devil.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Blue_devil.skn") diff --git a/skins/_old/Devil_skins/Green_devil/Tupfile.lua b/skins/_old/Devil_skins/Green_devil/Tupfile.lua new file mode 100644 index 0000000000..e43c479221 --- /dev/null +++ b/skins/_old/Devil_skins/Green_devil/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Green_devil.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Green_devil.skn") diff --git a/skins/_old/Devil_skins/Pink_devil/Tupfile.lua b/skins/_old/Devil_skins/Pink_devil/Tupfile.lua new file mode 100644 index 0000000000..2e82f1a628 --- /dev/null +++ b/skins/_old/Devil_skins/Pink_devil/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Pink_devil.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Pink_devil.skn") diff --git a/skins/_old/Devil_skins/Red_devil/Tupfile.lua b/skins/_old/Devil_skins/Red_devil/Tupfile.lua new file mode 100644 index 0000000000..034d6d4ad5 --- /dev/null +++ b/skins/_old/Devil_skins/Red_devil/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Red_devil.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Red_devil.skn") diff --git a/skins/_old/Devil_skins/Violet_devil/Tupfile.lua b/skins/_old/Devil_skins/Violet_devil/Tupfile.lua new file mode 100644 index 0000000000..a93e0c31be --- /dev/null +++ b/skins/_old/Devil_skins/Violet_devil/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Violet_devil.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Violet_devil.skn") diff --git a/skins/_old/Eyes/Tupfile.lua b/skins/_old/Eyes/Tupfile.lua new file mode 100644 index 0000000000..aef8e497d4 --- /dev/null +++ b/skins/_old/Eyes/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Eyes.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Eyes.skn") diff --git a/skins/_old/Fever/Fever1 blue/Tupfile.lua b/skins/_old/Fever/Fever1 blue/Tupfile.lua new file mode 100644 index 0000000000..335ef1f3bb --- /dev/null +++ b/skins/_old/Fever/Fever1 blue/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Fever_blue.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Fever1 blue.skn") diff --git a/skins/_old/Fever/Fever1 green/Tupfile.lua b/skins/_old/Fever/Fever1 green/Tupfile.lua new file mode 100644 index 0000000000..131d282d25 --- /dev/null +++ b/skins/_old/Fever/Fever1 green/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Fever_green.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Fever1 green.skn") diff --git a/skins/_old/Fever/Fever1 red/Tupfile.lua b/skins/_old/Fever/Fever1 red/Tupfile.lua new file mode 100644 index 0000000000..43e6e66bc2 --- /dev/null +++ b/skins/_old/Fever/Fever1 red/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Fever_red.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Fever1 red.skn") diff --git a/skins/_old/Fever/Fever2 blue/Tupfile.lua b/skins/_old/Fever/Fever2 blue/Tupfile.lua new file mode 100644 index 0000000000..99773dc0e6 --- /dev/null +++ b/skins/_old/Fever/Fever2 blue/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Fever_blue.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Fever2 blue.skn") diff --git a/skins/_old/Fever/Fever2 green/Tupfile.lua b/skins/_old/Fever/Fever2 green/Tupfile.lua new file mode 100644 index 0000000000..683513a9f5 --- /dev/null +++ b/skins/_old/Fever/Fever2 green/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Fever_green.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Fever2 green.skn") diff --git a/skins/_old/Fever/Fever2 red/Tupfile.lua b/skins/_old/Fever/Fever2 red/Tupfile.lua new file mode 100644 index 0000000000..1970bfc520 --- /dev/null +++ b/skins/_old/Fever/Fever2 red/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Fever_red.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Fever2 red.skn") diff --git a/skins/_old/Flowers/Tupfile.lua b/skins/_old/Flowers/Tupfile.lua new file mode 100644 index 0000000000..55d96bd14a --- /dev/null +++ b/skins/_old/Flowers/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Flowers.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Flowers.skn") diff --git a/skins/_old/Flyght/Tupfile.lua b/skins/_old/Flyght/Tupfile.lua new file mode 100644 index 0000000000..17780fd6ba --- /dev/null +++ b/skins/_old/Flyght/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Flyght.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Flyght.skn") diff --git a/skins/_old/Glass_lime/Tupfile.lua b/skins/_old/Glass_lime/Tupfile.lua new file mode 100644 index 0000000000..1bf304dd31 --- /dev/null +++ b/skins/_old/Glass_lime/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Glass_lime.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Glass_lime.skn") diff --git a/skins/_old/Grey/Tupfile.lua b/skins/_old/Grey/Tupfile.lua new file mode 100644 index 0000000000..393516c544 --- /dev/null +++ b/skins/_old/Grey/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Grey.skn") diff --git a/skins/_old/Hearts/Hearts 3d/Tupfile.lua b/skins/_old/Hearts/Hearts 3d/Tupfile.lua new file mode 100644 index 0000000000..00a878dd80 --- /dev/null +++ b/skins/_old/Hearts/Hearts 3d/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("hearts_3d.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Hearts 3d.skn") diff --git a/skins/_old/Hearts/Hearts flat/Tupfile.lua b/skins/_old/Hearts/Hearts flat/Tupfile.lua new file mode 100644 index 0000000000..75cb82c1ea --- /dev/null +++ b/skins/_old/Hearts/Hearts flat/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("hearts_flat.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Hearts flat.skn") diff --git a/skins/_old/Leency/AreaO/Tupfile.lua b/skins/_old/Leency/AreaO/Tupfile.lua new file mode 100644 index 0000000000..0374b9f177 --- /dev/null +++ b/skins/_old/Leency/AreaO/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "AreaO.skn") diff --git a/skins/_old/Leency/AreaSq/Tupfile.lua b/skins/_old/Leency/AreaSq/Tupfile.lua new file mode 100644 index 0000000000..386df758e8 --- /dev/null +++ b/skins/_old/Leency/AreaSq/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "AreaSq.skn") diff --git a/skins/_old/Leency/L-Junior/Tupfile.lua b/skins/_old/Leency/L-Junior/Tupfile.lua new file mode 100644 index 0000000000..8eb0d26cbe --- /dev/null +++ b/skins/_old/Leency/L-Junior/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("DEFAULT.ASM", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "L-Junior.skn") diff --git a/skins/_old/Leency/Latte/Tupfile.lua b/skins/_old/Leency/Latte/Tupfile.lua new file mode 100644 index 0000000000..cd78e842d4 --- /dev/null +++ b/skins/_old/Leency/Latte/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Latte.skn") diff --git a/skins/_old/Leency/Luna/Tupfile.lua b/skins/_old/Leency/Luna/Tupfile.lua new file mode 100644 index 0000000000..5e69202d19 --- /dev/null +++ b/skins/_old/Leency/Luna/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Luna.skn") diff --git a/skins/_old/Leency/Octo/Tupfile.lua b/skins/_old/Leency/Octo/Tupfile.lua new file mode 100644 index 0000000000..7292022faf --- /dev/null +++ b/skins/_old/Leency/Octo/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Octo.skn") diff --git a/skins/_old/Leency/Octo_flat/Tupfile.lua b/skins/_old/Leency/Octo_flat/Tupfile.lua new file mode 100644 index 0000000000..b70a788f34 --- /dev/null +++ b/skins/_old/Leency/Octo_flat/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Octo_flat.skn") diff --git a/skins/_old/Leency/OpusN/Tupfile.lua b/skins/_old/Leency/OpusN/Tupfile.lua new file mode 100644 index 0000000000..107dd04c33 --- /dev/null +++ b/skins/_old/Leency/OpusN/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("OpusN.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "OpusN.skn") diff --git a/skins/_old/Leency/Sandwich/Tupfile.lua b/skins/_old/Leency/Sandwich/Tupfile.lua new file mode 100644 index 0000000000..e2ffd8cdcb --- /dev/null +++ b/skins/_old/Leency/Sandwich/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Sandwich.skn") diff --git a/skins/_old/Leency/Yeah/Tupfile.lua b/skins/_old/Leency/Yeah/Tupfile.lua new file mode 100644 index 0000000000..4465dfd9a7 --- /dev/null +++ b/skins/_old/Leency/Yeah/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Yeah.skn") diff --git a/skins/_old/MenuetOS/1.MenuetOS/1/Active/base.bmp b/skins/_old/MenuetOS/1.MenuetOS/1/active/base.bmp similarity index 100% rename from skins/_old/MenuetOS/1.MenuetOS/1/Active/base.bmp rename to skins/_old/MenuetOS/1.MenuetOS/1/active/base.bmp diff --git a/skins/_old/MenuetOS/1.MenuetOS/1/Active/left.bmp b/skins/_old/MenuetOS/1.MenuetOS/1/active/left.bmp similarity index 100% rename from skins/_old/MenuetOS/1.MenuetOS/1/Active/left.bmp rename to skins/_old/MenuetOS/1.MenuetOS/1/active/left.bmp diff --git a/skins/_old/MenuetOS/1.MenuetOS/1/Active/oper.bmp b/skins/_old/MenuetOS/1.MenuetOS/1/active/oper.bmp similarity index 100% rename from skins/_old/MenuetOS/1.MenuetOS/1/Active/oper.bmp rename to skins/_old/MenuetOS/1.MenuetOS/1/active/oper.bmp diff --git a/skins/_old/MenuetOS/1.MenuetOS/1/Inactive/base.bmp b/skins/_old/MenuetOS/1.MenuetOS/1/inactive/base.bmp similarity index 100% rename from skins/_old/MenuetOS/1.MenuetOS/1/Inactive/base.bmp rename to skins/_old/MenuetOS/1.MenuetOS/1/inactive/base.bmp diff --git a/skins/_old/MenuetOS/1.MenuetOS/1/Inactive/left.bmp b/skins/_old/MenuetOS/1.MenuetOS/1/inactive/left.bmp similarity index 100% rename from skins/_old/MenuetOS/1.MenuetOS/1/Inactive/left.bmp rename to skins/_old/MenuetOS/1.MenuetOS/1/inactive/left.bmp diff --git a/skins/_old/MenuetOS/1.MenuetOS/1/Inactive/oper.bmp b/skins/_old/MenuetOS/1.MenuetOS/1/inactive/oper.bmp similarity index 100% rename from skins/_old/MenuetOS/1.MenuetOS/1/Inactive/oper.bmp rename to skins/_old/MenuetOS/1.MenuetOS/1/inactive/oper.bmp diff --git a/skins/_old/MenuetOS/1.MenuetOS/2/Tupfile.lua b/skins/_old/MenuetOS/1.MenuetOS/2/Tupfile.lua new file mode 100644 index 0000000000..8d201d8830 --- /dev/null +++ b/skins/_old/MenuetOS/1.MenuetOS/2/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("MenuetOS.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "1.MenuetOS.2.skn") diff --git a/skins/_old/MenuetOS/1.MenuetOS/2/Active/base.bmp b/skins/_old/MenuetOS/1.MenuetOS/2/active/base.bmp similarity index 100% rename from skins/_old/MenuetOS/1.MenuetOS/2/Active/base.bmp rename to skins/_old/MenuetOS/1.MenuetOS/2/active/base.bmp diff --git a/skins/_old/MenuetOS/1.MenuetOS/2/Active/left.bmp b/skins/_old/MenuetOS/1.MenuetOS/2/active/left.bmp similarity index 100% rename from skins/_old/MenuetOS/1.MenuetOS/2/Active/left.bmp rename to skins/_old/MenuetOS/1.MenuetOS/2/active/left.bmp diff --git a/skins/_old/MenuetOS/1.MenuetOS/2/Active/oper.bmp b/skins/_old/MenuetOS/1.MenuetOS/2/active/oper.bmp similarity index 100% rename from skins/_old/MenuetOS/1.MenuetOS/2/Active/oper.bmp rename to skins/_old/MenuetOS/1.MenuetOS/2/active/oper.bmp diff --git a/skins/_old/MenuetOS/1.MenuetOS/2/Inactive/base.bmp b/skins/_old/MenuetOS/1.MenuetOS/2/inactive/base.bmp similarity index 100% rename from skins/_old/MenuetOS/1.MenuetOS/2/Inactive/base.bmp rename to skins/_old/MenuetOS/1.MenuetOS/2/inactive/base.bmp diff --git a/skins/_old/MenuetOS/1.MenuetOS/2/Inactive/left.bmp b/skins/_old/MenuetOS/1.MenuetOS/2/inactive/left.bmp similarity index 100% rename from skins/_old/MenuetOS/1.MenuetOS/2/Inactive/left.bmp rename to skins/_old/MenuetOS/1.MenuetOS/2/inactive/left.bmp diff --git a/skins/_old/MenuetOS/1.MenuetOS/2/Inactive/oper.bmp b/skins/_old/MenuetOS/1.MenuetOS/2/inactive/oper.bmp similarity index 100% rename from skins/_old/MenuetOS/1.MenuetOS/2/Inactive/oper.bmp rename to skins/_old/MenuetOS/1.MenuetOS/2/inactive/oper.bmp diff --git a/skins/_old/MenuetOS/2.MenuetOS/1/Tupfile.lua b/skins/_old/MenuetOS/2.MenuetOS/1/Tupfile.lua new file mode 100644 index 0000000000..ea380781b4 --- /dev/null +++ b/skins/_old/MenuetOS/2.MenuetOS/1/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("MenuetOS.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "2.MenuetOS.1.skn") diff --git a/skins/_old/MenuetOS/2.MenuetOS/1/Active/base.bmp b/skins/_old/MenuetOS/2.MenuetOS/1/active/base.bmp similarity index 100% rename from skins/_old/MenuetOS/2.MenuetOS/1/Active/base.bmp rename to skins/_old/MenuetOS/2.MenuetOS/1/active/base.bmp diff --git a/skins/_old/MenuetOS/2.MenuetOS/1/Active/left.bmp b/skins/_old/MenuetOS/2.MenuetOS/1/active/left.bmp similarity index 100% rename from skins/_old/MenuetOS/2.MenuetOS/1/Active/left.bmp rename to skins/_old/MenuetOS/2.MenuetOS/1/active/left.bmp diff --git a/skins/_old/MenuetOS/2.MenuetOS/1/Active/oper.bmp b/skins/_old/MenuetOS/2.MenuetOS/1/active/oper.bmp similarity index 100% rename from skins/_old/MenuetOS/2.MenuetOS/1/Active/oper.bmp rename to skins/_old/MenuetOS/2.MenuetOS/1/active/oper.bmp diff --git a/skins/_old/MenuetOS/2.MenuetOS/1/Inactive/base.bmp b/skins/_old/MenuetOS/2.MenuetOS/1/inactive/base.bmp similarity index 100% rename from skins/_old/MenuetOS/2.MenuetOS/1/Inactive/base.bmp rename to skins/_old/MenuetOS/2.MenuetOS/1/inactive/base.bmp diff --git a/skins/_old/MenuetOS/2.MenuetOS/1/Inactive/left.bmp b/skins/_old/MenuetOS/2.MenuetOS/1/inactive/left.bmp similarity index 100% rename from skins/_old/MenuetOS/2.MenuetOS/1/Inactive/left.bmp rename to skins/_old/MenuetOS/2.MenuetOS/1/inactive/left.bmp diff --git a/skins/_old/MenuetOS/2.MenuetOS/1/Inactive/oper.bmp b/skins/_old/MenuetOS/2.MenuetOS/1/inactive/oper.bmp similarity index 100% rename from skins/_old/MenuetOS/2.MenuetOS/1/Inactive/oper.bmp rename to skins/_old/MenuetOS/2.MenuetOS/1/inactive/oper.bmp diff --git a/skins/_old/MenuetOS/2.MenuetOS/2/Tupfile.lua b/skins/_old/MenuetOS/2.MenuetOS/2/Tupfile.lua new file mode 100644 index 0000000000..7803fdb00c --- /dev/null +++ b/skins/_old/MenuetOS/2.MenuetOS/2/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("MenuetOS.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "2.MenuetOS.2.skn") diff --git a/skins/_old/MenuetOS/2.MenuetOS/2/Active/base.bmp b/skins/_old/MenuetOS/2.MenuetOS/2/active/base.bmp similarity index 100% rename from skins/_old/MenuetOS/2.MenuetOS/2/Active/base.bmp rename to skins/_old/MenuetOS/2.MenuetOS/2/active/base.bmp diff --git a/skins/_old/MenuetOS/2.MenuetOS/2/Active/left.bmp b/skins/_old/MenuetOS/2.MenuetOS/2/active/left.bmp similarity index 100% rename from skins/_old/MenuetOS/2.MenuetOS/2/Active/left.bmp rename to skins/_old/MenuetOS/2.MenuetOS/2/active/left.bmp diff --git a/skins/_old/MenuetOS/2.MenuetOS/2/Active/oper.bmp b/skins/_old/MenuetOS/2.MenuetOS/2/active/oper.bmp similarity index 100% rename from skins/_old/MenuetOS/2.MenuetOS/2/Active/oper.bmp rename to skins/_old/MenuetOS/2.MenuetOS/2/active/oper.bmp diff --git a/skins/_old/MenuetOS/2.MenuetOS/2/Inactive/base.bmp b/skins/_old/MenuetOS/2.MenuetOS/2/inactive/base.bmp similarity index 100% rename from skins/_old/MenuetOS/2.MenuetOS/2/Inactive/base.bmp rename to skins/_old/MenuetOS/2.MenuetOS/2/inactive/base.bmp diff --git a/skins/_old/MenuetOS/2.MenuetOS/2/Inactive/left.bmp b/skins/_old/MenuetOS/2.MenuetOS/2/inactive/left.bmp similarity index 100% rename from skins/_old/MenuetOS/2.MenuetOS/2/Inactive/left.bmp rename to skins/_old/MenuetOS/2.MenuetOS/2/inactive/left.bmp diff --git a/skins/_old/MenuetOS/2.MenuetOS/2/Inactive/oper.bmp b/skins/_old/MenuetOS/2.MenuetOS/2/inactive/oper.bmp similarity index 100% rename from skins/_old/MenuetOS/2.MenuetOS/2/Inactive/oper.bmp rename to skins/_old/MenuetOS/2.MenuetOS/2/inactive/oper.bmp diff --git a/skins/_old/MenuetOS/3.MenuetOS/1/Tupfile.lua b/skins/_old/MenuetOS/3.MenuetOS/1/Tupfile.lua new file mode 100644 index 0000000000..dcf82711f0 --- /dev/null +++ b/skins/_old/MenuetOS/3.MenuetOS/1/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("MenuetOS.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "3.MenuetOS.1.skn") diff --git a/skins/_old/MenuetOS/3.MenuetOS/1/Active/base.bmp b/skins/_old/MenuetOS/3.MenuetOS/1/active/base.bmp similarity index 100% rename from skins/_old/MenuetOS/3.MenuetOS/1/Active/base.bmp rename to skins/_old/MenuetOS/3.MenuetOS/1/active/base.bmp diff --git a/skins/_old/MenuetOS/3.MenuetOS/1/Active/left.bmp b/skins/_old/MenuetOS/3.MenuetOS/1/active/left.bmp similarity index 100% rename from skins/_old/MenuetOS/3.MenuetOS/1/Active/left.bmp rename to skins/_old/MenuetOS/3.MenuetOS/1/active/left.bmp diff --git a/skins/_old/MenuetOS/3.MenuetOS/1/Active/oper.bmp b/skins/_old/MenuetOS/3.MenuetOS/1/active/oper.bmp similarity index 100% rename from skins/_old/MenuetOS/3.MenuetOS/1/Active/oper.bmp rename to skins/_old/MenuetOS/3.MenuetOS/1/active/oper.bmp diff --git a/skins/_old/MenuetOS/3.MenuetOS/1/Inactive/base.bmp b/skins/_old/MenuetOS/3.MenuetOS/1/inactive/base.bmp similarity index 100% rename from skins/_old/MenuetOS/3.MenuetOS/1/Inactive/base.bmp rename to skins/_old/MenuetOS/3.MenuetOS/1/inactive/base.bmp diff --git a/skins/_old/MenuetOS/3.MenuetOS/1/Inactive/left.bmp b/skins/_old/MenuetOS/3.MenuetOS/1/inactive/left.bmp similarity index 100% rename from skins/_old/MenuetOS/3.MenuetOS/1/Inactive/left.bmp rename to skins/_old/MenuetOS/3.MenuetOS/1/inactive/left.bmp diff --git a/skins/_old/MenuetOS/3.MenuetOS/1/Inactive/oper.bmp b/skins/_old/MenuetOS/3.MenuetOS/1/inactive/oper.bmp similarity index 100% rename from skins/_old/MenuetOS/3.MenuetOS/1/Inactive/oper.bmp rename to skins/_old/MenuetOS/3.MenuetOS/1/inactive/oper.bmp diff --git a/skins/_old/MenuetOS/3.MenuetOS/2/Tupfile.lua b/skins/_old/MenuetOS/3.MenuetOS/2/Tupfile.lua new file mode 100644 index 0000000000..9fc4b1f525 --- /dev/null +++ b/skins/_old/MenuetOS/3.MenuetOS/2/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("MenuetOS.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "3.MenuetOS.2.skn") diff --git a/skins/_old/MenuetOS/3.MenuetOS/2/Active/base.bmp b/skins/_old/MenuetOS/3.MenuetOS/2/active/base.bmp similarity index 100% rename from skins/_old/MenuetOS/3.MenuetOS/2/Active/base.bmp rename to skins/_old/MenuetOS/3.MenuetOS/2/active/base.bmp diff --git a/skins/_old/MenuetOS/3.MenuetOS/2/Active/left.bmp b/skins/_old/MenuetOS/3.MenuetOS/2/active/left.bmp similarity index 100% rename from skins/_old/MenuetOS/3.MenuetOS/2/Active/left.bmp rename to skins/_old/MenuetOS/3.MenuetOS/2/active/left.bmp diff --git a/skins/_old/MenuetOS/3.MenuetOS/2/Active/oper.bmp b/skins/_old/MenuetOS/3.MenuetOS/2/active/oper.bmp similarity index 100% rename from skins/_old/MenuetOS/3.MenuetOS/2/Active/oper.bmp rename to skins/_old/MenuetOS/3.MenuetOS/2/active/oper.bmp diff --git a/skins/_old/MenuetOS/3.MenuetOS/2/Inactive/base.bmp b/skins/_old/MenuetOS/3.MenuetOS/2/inactive/base.bmp similarity index 100% rename from skins/_old/MenuetOS/3.MenuetOS/2/Inactive/base.bmp rename to skins/_old/MenuetOS/3.MenuetOS/2/inactive/base.bmp diff --git a/skins/_old/MenuetOS/3.MenuetOS/2/Inactive/left.bmp b/skins/_old/MenuetOS/3.MenuetOS/2/inactive/left.bmp similarity index 100% rename from skins/_old/MenuetOS/3.MenuetOS/2/Inactive/left.bmp rename to skins/_old/MenuetOS/3.MenuetOS/2/inactive/left.bmp diff --git a/skins/_old/MenuetOS/3.MenuetOS/2/Inactive/oper.bmp b/skins/_old/MenuetOS/3.MenuetOS/2/inactive/oper.bmp similarity index 100% rename from skins/_old/MenuetOS/3.MenuetOS/2/Inactive/oper.bmp rename to skins/_old/MenuetOS/3.MenuetOS/2/inactive/oper.bmp diff --git a/skins/_old/MenuetOS/4.MenuetOS/1/Tupfile.lua b/skins/_old/MenuetOS/4.MenuetOS/1/Tupfile.lua new file mode 100644 index 0000000000..9238a4afef --- /dev/null +++ b/skins/_old/MenuetOS/4.MenuetOS/1/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("MenuetOS.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "4.MenuetOS.1.skn") diff --git a/skins/_old/MenuetOS/4.MenuetOS/1/Active/base.bmp b/skins/_old/MenuetOS/4.MenuetOS/1/active/base.bmp similarity index 100% rename from skins/_old/MenuetOS/4.MenuetOS/1/Active/base.bmp rename to skins/_old/MenuetOS/4.MenuetOS/1/active/base.bmp diff --git a/skins/_old/MenuetOS/4.MenuetOS/1/Active/left.bmp b/skins/_old/MenuetOS/4.MenuetOS/1/active/left.bmp similarity index 100% rename from skins/_old/MenuetOS/4.MenuetOS/1/Active/left.bmp rename to skins/_old/MenuetOS/4.MenuetOS/1/active/left.bmp diff --git a/skins/_old/MenuetOS/4.MenuetOS/1/Active/oper.bmp b/skins/_old/MenuetOS/4.MenuetOS/1/active/oper.bmp similarity index 100% rename from skins/_old/MenuetOS/4.MenuetOS/1/Active/oper.bmp rename to skins/_old/MenuetOS/4.MenuetOS/1/active/oper.bmp diff --git a/skins/_old/MenuetOS/4.MenuetOS/1/Inactive/base.bmp b/skins/_old/MenuetOS/4.MenuetOS/1/inactive/base.bmp similarity index 100% rename from skins/_old/MenuetOS/4.MenuetOS/1/Inactive/base.bmp rename to skins/_old/MenuetOS/4.MenuetOS/1/inactive/base.bmp diff --git a/skins/_old/MenuetOS/4.MenuetOS/1/Inactive/left.bmp b/skins/_old/MenuetOS/4.MenuetOS/1/inactive/left.bmp similarity index 100% rename from skins/_old/MenuetOS/4.MenuetOS/1/Inactive/left.bmp rename to skins/_old/MenuetOS/4.MenuetOS/1/inactive/left.bmp diff --git a/skins/_old/MenuetOS/4.MenuetOS/1/Inactive/oper.bmp b/skins/_old/MenuetOS/4.MenuetOS/1/inactive/oper.bmp similarity index 100% rename from skins/_old/MenuetOS/4.MenuetOS/1/Inactive/oper.bmp rename to skins/_old/MenuetOS/4.MenuetOS/1/inactive/oper.bmp diff --git a/skins/_old/MenuetOS/4.MenuetOS/2/Tupfile.lua b/skins/_old/MenuetOS/4.MenuetOS/2/Tupfile.lua new file mode 100644 index 0000000000..c3ed68c2ee --- /dev/null +++ b/skins/_old/MenuetOS/4.MenuetOS/2/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("MenuetOS.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "4.MenuetOS.2.skn") diff --git a/skins/_old/MenuetOS/4.MenuetOS/2/Active/base.bmp b/skins/_old/MenuetOS/4.MenuetOS/2/active/base.bmp similarity index 100% rename from skins/_old/MenuetOS/4.MenuetOS/2/Active/base.bmp rename to skins/_old/MenuetOS/4.MenuetOS/2/active/base.bmp diff --git a/skins/_old/MenuetOS/4.MenuetOS/2/Active/left.bmp b/skins/_old/MenuetOS/4.MenuetOS/2/active/left.bmp similarity index 100% rename from skins/_old/MenuetOS/4.MenuetOS/2/Active/left.bmp rename to skins/_old/MenuetOS/4.MenuetOS/2/active/left.bmp diff --git a/skins/_old/MenuetOS/4.MenuetOS/2/Active/oper.bmp b/skins/_old/MenuetOS/4.MenuetOS/2/active/oper.bmp similarity index 100% rename from skins/_old/MenuetOS/4.MenuetOS/2/Active/oper.bmp rename to skins/_old/MenuetOS/4.MenuetOS/2/active/oper.bmp diff --git a/skins/_old/MenuetOS/4.MenuetOS/2/Inactive/base.bmp b/skins/_old/MenuetOS/4.MenuetOS/2/inactive/base.bmp similarity index 100% rename from skins/_old/MenuetOS/4.MenuetOS/2/Inactive/base.bmp rename to skins/_old/MenuetOS/4.MenuetOS/2/inactive/base.bmp diff --git a/skins/_old/MenuetOS/4.MenuetOS/2/Inactive/left.bmp b/skins/_old/MenuetOS/4.MenuetOS/2/inactive/left.bmp similarity index 100% rename from skins/_old/MenuetOS/4.MenuetOS/2/Inactive/left.bmp rename to skins/_old/MenuetOS/4.MenuetOS/2/inactive/left.bmp diff --git a/skins/_old/MenuetOS/4.MenuetOS/2/Inactive/oper.bmp b/skins/_old/MenuetOS/4.MenuetOS/2/inactive/oper.bmp similarity index 100% rename from skins/_old/MenuetOS/4.MenuetOS/2/Inactive/oper.bmp rename to skins/_old/MenuetOS/4.MenuetOS/2/inactive/oper.bmp diff --git a/skins/_old/MenuetOS/5.MenuetOS/1/Tupfile.lua b/skins/_old/MenuetOS/5.MenuetOS/1/Tupfile.lua new file mode 100644 index 0000000000..db1ac6aba3 --- /dev/null +++ b/skins/_old/MenuetOS/5.MenuetOS/1/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("MenuetOS.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "5.MenuetOS.1.skn") diff --git a/skins/_old/MenuetOS/5.MenuetOS/1/Active/base.bmp b/skins/_old/MenuetOS/5.MenuetOS/1/active/base.bmp similarity index 100% rename from skins/_old/MenuetOS/5.MenuetOS/1/Active/base.bmp rename to skins/_old/MenuetOS/5.MenuetOS/1/active/base.bmp diff --git a/skins/_old/MenuetOS/5.MenuetOS/1/Active/left.bmp b/skins/_old/MenuetOS/5.MenuetOS/1/active/left.bmp similarity index 100% rename from skins/_old/MenuetOS/5.MenuetOS/1/Active/left.bmp rename to skins/_old/MenuetOS/5.MenuetOS/1/active/left.bmp diff --git a/skins/_old/MenuetOS/5.MenuetOS/1/Active/oper.bmp b/skins/_old/MenuetOS/5.MenuetOS/1/active/oper.bmp similarity index 100% rename from skins/_old/MenuetOS/5.MenuetOS/1/Active/oper.bmp rename to skins/_old/MenuetOS/5.MenuetOS/1/active/oper.bmp diff --git a/skins/_old/MenuetOS/5.MenuetOS/1/Inactive/base.bmp b/skins/_old/MenuetOS/5.MenuetOS/1/inactive/base.bmp similarity index 100% rename from skins/_old/MenuetOS/5.MenuetOS/1/Inactive/base.bmp rename to skins/_old/MenuetOS/5.MenuetOS/1/inactive/base.bmp diff --git a/skins/_old/MenuetOS/5.MenuetOS/1/Inactive/left.bmp b/skins/_old/MenuetOS/5.MenuetOS/1/inactive/left.bmp similarity index 100% rename from skins/_old/MenuetOS/5.MenuetOS/1/Inactive/left.bmp rename to skins/_old/MenuetOS/5.MenuetOS/1/inactive/left.bmp diff --git a/skins/_old/MenuetOS/5.MenuetOS/1/Inactive/oper.bmp b/skins/_old/MenuetOS/5.MenuetOS/1/inactive/oper.bmp similarity index 100% rename from skins/_old/MenuetOS/5.MenuetOS/1/Inactive/oper.bmp rename to skins/_old/MenuetOS/5.MenuetOS/1/inactive/oper.bmp diff --git a/skins/_old/MenuetOS/5.MenuetOS/2/Tupfile.lua b/skins/_old/MenuetOS/5.MenuetOS/2/Tupfile.lua new file mode 100644 index 0000000000..9a1cae3142 --- /dev/null +++ b/skins/_old/MenuetOS/5.MenuetOS/2/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("MenuetOS.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "5.MenuetOS.2.skn") diff --git a/skins/_old/MenuetOS/5.MenuetOS/2/Active/base.bmp b/skins/_old/MenuetOS/5.MenuetOS/2/active/base.bmp similarity index 100% rename from skins/_old/MenuetOS/5.MenuetOS/2/Active/base.bmp rename to skins/_old/MenuetOS/5.MenuetOS/2/active/base.bmp diff --git a/skins/_old/MenuetOS/5.MenuetOS/2/Active/left.bmp b/skins/_old/MenuetOS/5.MenuetOS/2/active/left.bmp similarity index 100% rename from skins/_old/MenuetOS/5.MenuetOS/2/Active/left.bmp rename to skins/_old/MenuetOS/5.MenuetOS/2/active/left.bmp diff --git a/skins/_old/MenuetOS/5.MenuetOS/2/Active/oper.bmp b/skins/_old/MenuetOS/5.MenuetOS/2/active/oper.bmp similarity index 100% rename from skins/_old/MenuetOS/5.MenuetOS/2/Active/oper.bmp rename to skins/_old/MenuetOS/5.MenuetOS/2/active/oper.bmp diff --git a/skins/_old/MenuetOS/5.MenuetOS/2/Inactive/base.bmp b/skins/_old/MenuetOS/5.MenuetOS/2/inactive/base.bmp similarity index 100% rename from skins/_old/MenuetOS/5.MenuetOS/2/Inactive/base.bmp rename to skins/_old/MenuetOS/5.MenuetOS/2/inactive/base.bmp diff --git a/skins/_old/MenuetOS/5.MenuetOS/2/Inactive/left.bmp b/skins/_old/MenuetOS/5.MenuetOS/2/inactive/left.bmp similarity index 100% rename from skins/_old/MenuetOS/5.MenuetOS/2/Inactive/left.bmp rename to skins/_old/MenuetOS/5.MenuetOS/2/inactive/left.bmp diff --git a/skins/_old/MenuetOS/5.MenuetOS/2/Inactive/oper.bmp b/skins/_old/MenuetOS/5.MenuetOS/2/inactive/oper.bmp similarity index 100% rename from skins/_old/MenuetOS/5.MenuetOS/2/Inactive/oper.bmp rename to skins/_old/MenuetOS/5.MenuetOS/2/inactive/oper.bmp diff --git a/skins/_old/MetalColor/MCBlue/Tupfile.lua b/skins/_old/MetalColor/MCBlue/Tupfile.lua new file mode 100644 index 0000000000..aac4542181 --- /dev/null +++ b/skins/_old/MetalColor/MCBlue/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("MCBlue.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "MCBlue.skn") diff --git a/skins/_old/MetalColor/MCRed/Tupfile.lua b/skins/_old/MetalColor/MCRed/Tupfile.lua new file mode 100644 index 0000000000..9e49db9960 --- /dev/null +++ b/skins/_old/MetalColor/MCRed/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("MCRed.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "MCRed.skn") diff --git a/skins/_old/MetalGearArrows/1.MetalGearArrows/Tupfile.lua b/skins/_old/MetalGearArrows/1.MetalGearArrows/Tupfile.lua new file mode 100644 index 0000000000..e3ee7cf91e --- /dev/null +++ b/skins/_old/MetalGearArrows/1.MetalGearArrows/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("1.MetalGearArrows.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "1.MetalGearArrows.skn") diff --git a/skins/_old/MetalGearArrows/2.MetalGearArrows/Tupfile.lua b/skins/_old/MetalGearArrows/2.MetalGearArrows/Tupfile.lua new file mode 100644 index 0000000000..8a23ea5989 --- /dev/null +++ b/skins/_old/MetalGearArrows/2.MetalGearArrows/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("2.MetalGearArrows.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "2.MetalGearArrows.skn") diff --git a/skins/_old/MetalGearArrows/3.MetalGearArrows/Tupfile.lua b/skins/_old/MetalGearArrows/3.MetalGearArrows/Tupfile.lua new file mode 100644 index 0000000000..94d2c44587 --- /dev/null +++ b/skins/_old/MetalGearArrows/3.MetalGearArrows/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("3.MetalGearArrows.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "3.MetalGearArrows.skn") diff --git a/skins/_old/MetalGearArrows/4.MetalGearArrows/Tupfile.lua b/skins/_old/MetalGearArrows/4.MetalGearArrows/Tupfile.lua new file mode 100644 index 0000000000..a4287edef7 --- /dev/null +++ b/skins/_old/MetalGearArrows/4.MetalGearArrows/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("4.MetalGearArrows.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "4.MetalGearArrows.skn") diff --git a/skins/_old/MyTango/Tupfile.lua b/skins/_old/MyTango/Tupfile.lua new file mode 100644 index 0000000000..589b12a1a8 --- /dev/null +++ b/skins/_old/MyTango/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "MyTango.skn") diff --git a/skins/_old/Nature/Sandwich/Sandwich.skn b/skins/_old/Nature/Sandwich/Sandwich.skn deleted file mode 100644 index ff3d29489c..0000000000 Binary files a/skins/_old/Nature/Sandwich/Sandwich.skn and /dev/null differ diff --git a/skins/_old/Nature/Sandwich/src/Tupfile.lua b/skins/_old/Nature/Sandwich/src/Tupfile.lua new file mode 100644 index 0000000000..3a516907de --- /dev/null +++ b/skins/_old/Nature/Sandwich/src/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "src.skn") diff --git a/skins/_old/Nature/Sandwich/src/default.skn b/skins/_old/Nature/Sandwich/src/default.skn deleted file mode 100644 index ff3d29489c..0000000000 Binary files a/skins/_old/Nature/Sandwich/src/default.skn and /dev/null differ diff --git a/skins/_old/Nature/Tupfile.lua b/skins/_old/Nature/Tupfile.lua new file mode 100644 index 0000000000..df22d8c6ca --- /dev/null +++ b/skins/_old/Nature/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Nature.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Nature.skn") diff --git a/skins/_old/Nova_skins/Nova_blue/Nova_blue.skn b/skins/_old/Nova_skins/Nova_blue/Nova_blue.skn deleted file mode 100644 index 3cbe89fc36..0000000000 Binary files a/skins/_old/Nova_skins/Nova_blue/Nova_blue.skn and /dev/null differ diff --git a/skins/_old/Nova_skins/Nova_blue/Tupfile.lua b/skins/_old/Nova_skins/Nova_blue/Tupfile.lua new file mode 100644 index 0000000000..23ffbd55ed --- /dev/null +++ b/skins/_old/Nova_skins/Nova_blue/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Nova_blue.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Nova_blue.skn") diff --git a/skins/_old/Nova_skins/Nova_brown/Nova_brown.skn b/skins/_old/Nova_skins/Nova_brown/Nova_brown.skn deleted file mode 100644 index 0ece02e1cc..0000000000 Binary files a/skins/_old/Nova_skins/Nova_brown/Nova_brown.skn and /dev/null differ diff --git a/skins/_old/Nova_skins/Nova_brown/Tupfile.lua b/skins/_old/Nova_skins/Nova_brown/Tupfile.lua new file mode 100644 index 0000000000..eb4e23a6e2 --- /dev/null +++ b/skins/_old/Nova_skins/Nova_brown/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Nova_brown.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Nova_brown.skn") diff --git a/skins/_old/Nova_skins/Nova_green/Nova_green.skn b/skins/_old/Nova_skins/Nova_green/Nova_green.skn deleted file mode 100644 index 1b72bfa37f..0000000000 Binary files a/skins/_old/Nova_skins/Nova_green/Nova_green.skn and /dev/null differ diff --git a/skins/_old/Nova_skins/Nova_green/Tupfile.lua b/skins/_old/Nova_skins/Nova_green/Tupfile.lua new file mode 100644 index 0000000000..ac694e3702 --- /dev/null +++ b/skins/_old/Nova_skins/Nova_green/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Nova_green.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Nova_green.skn") diff --git a/skins/_old/Nova_skins/Nova_grey/Nova_grey.skn b/skins/_old/Nova_skins/Nova_grey/Nova_grey.skn deleted file mode 100644 index 4d3190a1e9..0000000000 Binary files a/skins/_old/Nova_skins/Nova_grey/Nova_grey.skn and /dev/null differ diff --git a/skins/_old/Nova_skins/Nova_grey/Tupfile.lua b/skins/_old/Nova_skins/Nova_grey/Tupfile.lua new file mode 100644 index 0000000000..f662e308f8 --- /dev/null +++ b/skins/_old/Nova_skins/Nova_grey/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Nova_grey.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Nova_grey.skn") diff --git a/skins/_old/Nova_skins/Nova_pink/Nova_pink.skn b/skins/_old/Nova_skins/Nova_pink/Nova_pink.skn deleted file mode 100644 index dbc07d23e4..0000000000 Binary files a/skins/_old/Nova_skins/Nova_pink/Nova_pink.skn and /dev/null differ diff --git a/skins/_old/Nova_skins/Nova_pink/Tupfile.lua b/skins/_old/Nova_skins/Nova_pink/Tupfile.lua new file mode 100644 index 0000000000..e4a3ca8374 --- /dev/null +++ b/skins/_old/Nova_skins/Nova_pink/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Nova_pink.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Nova_pink.skn") diff --git a/skins/_old/Nova_skins/Nova_red/Nova_red.skn b/skins/_old/Nova_skins/Nova_red/Nova_red.skn deleted file mode 100644 index 53afb0aacd..0000000000 Binary files a/skins/_old/Nova_skins/Nova_red/Nova_red.skn and /dev/null differ diff --git a/skins/_old/Nova_skins/Nova_red/Tupfile.lua b/skins/_old/Nova_skins/Nova_red/Tupfile.lua new file mode 100644 index 0000000000..66658e1a2a --- /dev/null +++ b/skins/_old/Nova_skins/Nova_red/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Nova_red.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Nova_red.skn") diff --git a/skins/_old/Nova_skins/Nova_violet/Nova_violet.skn b/skins/_old/Nova_skins/Nova_violet/Nova_violet.skn deleted file mode 100644 index 7895c1d692..0000000000 Binary files a/skins/_old/Nova_skins/Nova_violet/Nova_violet.skn and /dev/null differ diff --git a/skins/_old/Nova_skins/Nova_violet/Tupfile.lua b/skins/_old/Nova_skins/Nova_violet/Tupfile.lua new file mode 100644 index 0000000000..4078aa1f4a --- /dev/null +++ b/skins/_old/Nova_skins/Nova_violet/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Nova_violet.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Nova_violet.skn") diff --git a/skins/_old/OpusOs_Blue/Tupfile.lua b/skins/_old/OpusOs_Blue/Tupfile.lua new file mode 100644 index 0000000000..860822f076 --- /dev/null +++ b/skins/_old/OpusOs_Blue/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("OpusOs_Blue.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "OpusOs_Blue.skn") diff --git a/skins/_old/Orange_Silence/Tupfile.lua b/skins/_old/Orange_Silence/Tupfile.lua new file mode 100644 index 0000000000..105dafe51c --- /dev/null +++ b/skins/_old/Orange_Silence/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Orange_Silence.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Orange_Silence.skn") diff --git a/skins/_old/Orange_aureole/Tupfile.lua b/skins/_old/Orange_aureole/Tupfile.lua new file mode 100644 index 0000000000..4dac99625b --- /dev/null +++ b/skins/_old/Orange_aureole/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("orange_aureole.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Orange_aureole.skn") diff --git a/skins/_old/Organics/Tupfile.lua b/skins/_old/Organics/Tupfile.lua new file mode 100644 index 0000000000..71b2732b7a --- /dev/null +++ b/skins/_old/Organics/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Organics.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Organics.skn") diff --git a/skins/_old/Rednex/Tupfile.lua b/skins/_old/Rednex/Tupfile.lua new file mode 100644 index 0000000000..4d37eee3c8 --- /dev/null +++ b/skins/_old/Rednex/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Rednex.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Rednex.skn") diff --git a/skins/_old/RoboTech/BRoboTech/Tupfile.lua b/skins/_old/RoboTech/BRoboTech/Tupfile.lua new file mode 100644 index 0000000000..2f798b7b9e --- /dev/null +++ b/skins/_old/RoboTech/BRoboTech/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("BRoboTech.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "BRoboTech.skn") diff --git a/skins/_old/RoboTech/GRoboTech/Tupfile.lua b/skins/_old/RoboTech/GRoboTech/Tupfile.lua new file mode 100644 index 0000000000..0387fed7d4 --- /dev/null +++ b/skins/_old/RoboTech/GRoboTech/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("GRoboTech.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "GRoboTech.skn") diff --git a/skins/_old/Russia/Tupfile.lua b/skins/_old/Russia/Tupfile.lua new file mode 100644 index 0000000000..93930ff613 --- /dev/null +++ b/skins/_old/Russia/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("russia.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Russia.skn") diff --git a/skins/_old/Russia/russia.skn b/skins/_old/Russia/russia.skn deleted file mode 100644 index 791ebb186d..0000000000 Binary files a/skins/_old/Russia/russia.skn and /dev/null differ diff --git a/skins/_old/Sad_grey/Tupfile.lua b/skins/_old/Sad_grey/Tupfile.lua new file mode 100644 index 0000000000..71fcffde69 --- /dev/null +++ b/skins/_old/Sad_grey/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Sad_grey.skn") diff --git a/skins/_old/Sad_grey/default.skn b/skins/_old/Sad_grey/default.skn deleted file mode 100644 index 8c6ceb0e55..0000000000 Binary files a/skins/_old/Sad_grey/default.skn and /dev/null differ diff --git a/skins/_old/SashSkinPack_1_1/Aqua.skn b/skins/_old/SashSkinPack_1_1/Aqua.skn deleted file mode 100644 index 773bce708e..0000000000 Binary files a/skins/_old/SashSkinPack_1_1/Aqua.skn and /dev/null differ diff --git a/skins/_old/SashSkinPack_1_1/Cold.skn b/skins/_old/SashSkinPack_1_1/Cold.skn deleted file mode 100644 index 0395450fc4..0000000000 Binary files a/skins/_old/SashSkinPack_1_1/Cold.skn and /dev/null differ diff --git a/skins/_old/SashSkinPack_1_1/Metal.skn b/skins/_old/SashSkinPack_1_1/Metal.skn deleted file mode 100644 index 6b6e0fc2b6..0000000000 Binary files a/skins/_old/SashSkinPack_1_1/Metal.skn and /dev/null differ diff --git a/skins/_old/SashSkinPack_1_1/Src/Aqua/Tupfile.lua b/skins/_old/SashSkinPack_1_1/Src/Aqua/Tupfile.lua new file mode 100644 index 0000000000..a03203fdb3 --- /dev/null +++ b/skins/_old/SashSkinPack_1_1/Src/Aqua/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Aqua.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Aqua.skn") diff --git a/skins/_old/SashSkinPack_1_1/Src/Aqua/Active/base.bmp b/skins/_old/SashSkinPack_1_1/Src/Aqua/active/base.bmp similarity index 100% rename from skins/_old/SashSkinPack_1_1/Src/Aqua/Active/base.bmp rename to skins/_old/SashSkinPack_1_1/Src/Aqua/active/base.bmp diff --git a/skins/_old/SashSkinPack_1_1/Src/Aqua/Active/left.bmp b/skins/_old/SashSkinPack_1_1/Src/Aqua/active/left.bmp similarity index 100% rename from skins/_old/SashSkinPack_1_1/Src/Aqua/Active/left.bmp rename to skins/_old/SashSkinPack_1_1/Src/Aqua/active/left.bmp diff --git a/skins/_old/SashSkinPack_1_1/Src/Aqua/Active/oper.bmp b/skins/_old/SashSkinPack_1_1/Src/Aqua/active/oper.bmp similarity index 100% rename from skins/_old/SashSkinPack_1_1/Src/Aqua/Active/oper.bmp rename to skins/_old/SashSkinPack_1_1/Src/Aqua/active/oper.bmp diff --git a/skins/_old/SashSkinPack_1_1/Src/Aqua/colors.DTP b/skins/_old/SashSkinPack_1_1/Src/Aqua/colors.dtp similarity index 100% rename from skins/_old/SashSkinPack_1_1/Src/Aqua/colors.DTP rename to skins/_old/SashSkinPack_1_1/Src/Aqua/colors.dtp diff --git a/skins/_old/SashSkinPack_1_1/Src/Aqua/Inactive/base.bmp b/skins/_old/SashSkinPack_1_1/Src/Aqua/inactive/base.bmp similarity index 100% rename from skins/_old/SashSkinPack_1_1/Src/Aqua/Inactive/base.bmp rename to skins/_old/SashSkinPack_1_1/Src/Aqua/inactive/base.bmp diff --git a/skins/_old/SashSkinPack_1_1/Src/Aqua/Inactive/left.bmp b/skins/_old/SashSkinPack_1_1/Src/Aqua/inactive/left.bmp similarity index 100% rename from skins/_old/SashSkinPack_1_1/Src/Aqua/Inactive/left.bmp rename to skins/_old/SashSkinPack_1_1/Src/Aqua/inactive/left.bmp diff --git a/skins/_old/SashSkinPack_1_1/Src/Aqua/Inactive/oper.bmp b/skins/_old/SashSkinPack_1_1/Src/Aqua/inactive/oper.bmp similarity index 100% rename from skins/_old/SashSkinPack_1_1/Src/Aqua/Inactive/oper.bmp rename to skins/_old/SashSkinPack_1_1/Src/Aqua/inactive/oper.bmp diff --git a/skins/_old/SashSkinPack_1_1/Src/Cold/Tupfile.lua b/skins/_old/SashSkinPack_1_1/Src/Cold/Tupfile.lua new file mode 100644 index 0000000000..49b05f9554 --- /dev/null +++ b/skins/_old/SashSkinPack_1_1/Src/Cold/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Cold.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Cold.skn") diff --git a/skins/_old/SashSkinPack_1_1/Src/Cold/Active/base.bmp b/skins/_old/SashSkinPack_1_1/Src/Cold/active/base.bmp similarity index 100% rename from skins/_old/SashSkinPack_1_1/Src/Cold/Active/base.bmp rename to skins/_old/SashSkinPack_1_1/Src/Cold/active/base.bmp diff --git a/skins/_old/SashSkinPack_1_1/Src/Cold/Active/left.bmp b/skins/_old/SashSkinPack_1_1/Src/Cold/active/left.bmp similarity index 100% rename from skins/_old/SashSkinPack_1_1/Src/Cold/Active/left.bmp rename to skins/_old/SashSkinPack_1_1/Src/Cold/active/left.bmp diff --git a/skins/_old/SashSkinPack_1_1/Src/Cold/Active/oper.bmp b/skins/_old/SashSkinPack_1_1/Src/Cold/active/oper.bmp similarity index 100% rename from skins/_old/SashSkinPack_1_1/Src/Cold/Active/oper.bmp rename to skins/_old/SashSkinPack_1_1/Src/Cold/active/oper.bmp diff --git a/skins/_old/SashSkinPack_1_1/Src/Cold/colors.DTP b/skins/_old/SashSkinPack_1_1/Src/Cold/colors.dtp similarity index 100% rename from skins/_old/SashSkinPack_1_1/Src/Cold/colors.DTP rename to skins/_old/SashSkinPack_1_1/Src/Cold/colors.dtp diff --git a/skins/_old/SashSkinPack_1_1/Src/Cold/Inactive/base.bmp b/skins/_old/SashSkinPack_1_1/Src/Cold/inactive/base.bmp similarity index 100% rename from skins/_old/SashSkinPack_1_1/Src/Cold/Inactive/base.bmp rename to skins/_old/SashSkinPack_1_1/Src/Cold/inactive/base.bmp diff --git a/skins/_old/SashSkinPack_1_1/Src/Cold/Inactive/left.bmp b/skins/_old/SashSkinPack_1_1/Src/Cold/inactive/left.bmp similarity index 100% rename from skins/_old/SashSkinPack_1_1/Src/Cold/Inactive/left.bmp rename to skins/_old/SashSkinPack_1_1/Src/Cold/inactive/left.bmp diff --git a/skins/_old/SashSkinPack_1_1/Src/Cold/Inactive/oper.bmp b/skins/_old/SashSkinPack_1_1/Src/Cold/inactive/oper.bmp similarity index 100% rename from skins/_old/SashSkinPack_1_1/Src/Cold/Inactive/oper.bmp rename to skins/_old/SashSkinPack_1_1/Src/Cold/inactive/oper.bmp diff --git a/skins/_old/SashSkinPack_1_1/Src/Metal/Tupfile.lua b/skins/_old/SashSkinPack_1_1/Src/Metal/Tupfile.lua new file mode 100644 index 0000000000..175215386a --- /dev/null +++ b/skins/_old/SashSkinPack_1_1/Src/Metal/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Metal.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Metal.skn") diff --git a/skins/_old/SashSkinPack_1_1/Src/Metal/Active/base.bmp b/skins/_old/SashSkinPack_1_1/Src/Metal/active/base.bmp similarity index 100% rename from skins/_old/SashSkinPack_1_1/Src/Metal/Active/base.bmp rename to skins/_old/SashSkinPack_1_1/Src/Metal/active/base.bmp diff --git a/skins/_old/SashSkinPack_1_1/Src/Metal/Active/left.bmp b/skins/_old/SashSkinPack_1_1/Src/Metal/active/left.bmp similarity index 100% rename from skins/_old/SashSkinPack_1_1/Src/Metal/Active/left.bmp rename to skins/_old/SashSkinPack_1_1/Src/Metal/active/left.bmp diff --git a/skins/_old/SashSkinPack_1_1/Src/Metal/Active/oper.bmp b/skins/_old/SashSkinPack_1_1/Src/Metal/active/oper.bmp similarity index 100% rename from skins/_old/SashSkinPack_1_1/Src/Metal/Active/oper.bmp rename to skins/_old/SashSkinPack_1_1/Src/Metal/active/oper.bmp diff --git a/skins/_old/SashSkinPack_1_1/Src/Metal/Inactive/base.bmp b/skins/_old/SashSkinPack_1_1/Src/Metal/inactive/base.bmp similarity index 100% rename from skins/_old/SashSkinPack_1_1/Src/Metal/Inactive/base.bmp rename to skins/_old/SashSkinPack_1_1/Src/Metal/inactive/base.bmp diff --git a/skins/_old/SashSkinPack_1_1/Src/Metal/Inactive/left.bmp b/skins/_old/SashSkinPack_1_1/Src/Metal/inactive/left.bmp similarity index 100% rename from skins/_old/SashSkinPack_1_1/Src/Metal/Inactive/left.bmp rename to skins/_old/SashSkinPack_1_1/Src/Metal/inactive/left.bmp diff --git a/skins/_old/SashSkinPack_1_1/Src/Metal/Inactive/oper.bmp b/skins/_old/SashSkinPack_1_1/Src/Metal/inactive/oper.bmp similarity index 100% rename from skins/_old/SashSkinPack_1_1/Src/Metal/Inactive/oper.bmp rename to skins/_old/SashSkinPack_1_1/Src/Metal/inactive/oper.bmp diff --git a/skins/_old/Simple_gray/Tupfile.lua b/skins/_old/Simple_gray/Tupfile.lua new file mode 100644 index 0000000000..dcc3e28590 --- /dev/null +++ b/skins/_old/Simple_gray/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("simple_gray.ASM", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Simple_gray.skn") diff --git a/skins/_old/StyleVista/vista/Tupfile.lua b/skins/_old/StyleVista/vista/Tupfile.lua new file mode 100644 index 0000000000..29f95cb4e6 --- /dev/null +++ b/skins/_old/StyleVista/vista/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "StyleVista_vista.skn") diff --git a/skins/_old/StyleVista/vista/default.skn b/skins/_old/StyleVista/vista/default.skn deleted file mode 100644 index 088d7a058e..0000000000 Binary files a/skins/_old/StyleVista/vista/default.skn and /dev/null differ diff --git a/skins/_old/StyleVista/vista_basic/Tupfile.lua b/skins/_old/StyleVista/vista_basic/Tupfile.lua new file mode 100644 index 0000000000..a453c8c79b --- /dev/null +++ b/skins/_old/StyleVista/vista_basic/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "vista_basic.skn") diff --git a/skins/_old/StyleVista/vista_basic/default.skn b/skins/_old/StyleVista/vista_basic/default.skn deleted file mode 100644 index 076ead4014..0000000000 Binary files a/skins/_old/StyleVista/vista_basic/default.skn and /dev/null differ diff --git a/skins/_old/StyleVista/vista_basic_black/Tupfile.lua b/skins/_old/StyleVista/vista_basic_black/Tupfile.lua new file mode 100644 index 0000000000..35442623bc --- /dev/null +++ b/skins/_old/StyleVista/vista_basic_black/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "vista_basic_black.skn") diff --git a/skins/_old/StyleVista/vista_basic_black/default.skn b/skins/_old/StyleVista/vista_basic_black/default.skn deleted file mode 100644 index 3fb29e6077..0000000000 Binary files a/skins/_old/StyleVista/vista_basic_black/default.skn and /dev/null differ diff --git a/skins/_old/StyleVista/vista_dark/Tupfile.lua b/skins/_old/StyleVista/vista_dark/Tupfile.lua new file mode 100644 index 0000000000..9c8a16047f --- /dev/null +++ b/skins/_old/StyleVista/vista_dark/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "vista_dark.skn") diff --git a/skins/_old/StyleVista/vista_dark/default.skn b/skins/_old/StyleVista/vista_dark/default.skn deleted file mode 100644 index 48a1d34ec0..0000000000 Binary files a/skins/_old/StyleVista/vista_dark/default.skn and /dev/null differ diff --git a/skins/_old/StyleXP/orqua/Tupfile.lua b/skins/_old/StyleXP/orqua/Tupfile.lua new file mode 100644 index 0000000000..d5dc17c37d --- /dev/null +++ b/skins/_old/StyleXP/orqua/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "orqua.skn") diff --git a/skins/_old/StyleXP/orqua/default.skn b/skins/_old/StyleXP/orqua/default.skn deleted file mode 100644 index 0f877d292f..0000000000 Binary files a/skins/_old/StyleXP/orqua/default.skn and /dev/null differ diff --git a/skins/_old/StyleXP/panther/Tupfile.lua b/skins/_old/StyleXP/panther/Tupfile.lua new file mode 100644 index 0000000000..d8c6cb6180 --- /dev/null +++ b/skins/_old/StyleXP/panther/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "StyleXP_panther.skn") diff --git a/skins/_old/StyleXP/panther/default.skn b/skins/_old/StyleXP/panther/default.skn deleted file mode 100644 index ecf02dbaaf..0000000000 Binary files a/skins/_old/StyleXP/panther/default.skn and /dev/null differ diff --git a/skins/_old/StyleXP/wmpx/Tupfile.lua b/skins/_old/StyleXP/wmpx/Tupfile.lua new file mode 100644 index 0000000000..bdcdcdcc25 --- /dev/null +++ b/skins/_old/StyleXP/wmpx/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "wmpx.skn") diff --git a/skins/_old/StyleXP/wmpx/default.skn b/skins/_old/StyleXP/wmpx/default.skn deleted file mode 100644 index 77ec8b3e7c..0000000000 Binary files a/skins/_old/StyleXP/wmpx/default.skn and /dev/null differ diff --git a/skins/_old/Syllable/Tupfile.lua b/skins/_old/Syllable/Tupfile.lua new file mode 100644 index 0000000000..5fe46e641f --- /dev/null +++ b/skins/_old/Syllable/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Syllable.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Syllable.skn") diff --git a/skins/_old/USSR/Tupfile.lua b/skins/_old/USSR/Tupfile.lua new file mode 100644 index 0000000000..af050a2d50 --- /dev/null +++ b/skins/_old/USSR/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("USSR.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "USSR.skn") diff --git a/skins/_old/USSR_2/1.USSR_2/Tupfile.lua b/skins/_old/USSR_2/1.USSR_2/Tupfile.lua new file mode 100644 index 0000000000..1258891ad7 --- /dev/null +++ b/skins/_old/USSR_2/1.USSR_2/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("1.USSR_2.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "1.USSR_2.skn") diff --git a/skins/_old/USSR_2/2.USSR_2/Tupfile.lua b/skins/_old/USSR_2/2.USSR_2/Tupfile.lua new file mode 100644 index 0000000000..9f1b3adc4c --- /dev/null +++ b/skins/_old/USSR_2/2.USSR_2/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("2.USSR_2.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "2.USSR_2.skn") diff --git a/skins/_old/Victory_1945/Tupfile.lua b/skins/_old/Victory_1945/Tupfile.lua new file mode 100644 index 0000000000..265de59de0 --- /dev/null +++ b/skins/_old/Victory_1945/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Victory_1945.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Victory_1945.skn") diff --git a/skins/_old/WIN311/Tupfile.lua b/skins/_old/WIN311/Tupfile.lua new file mode 100644 index 0000000000..6caa0a4dac --- /dev/null +++ b/skins/_old/WIN311/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Win311.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "WIN311.skn") diff --git a/skins/_old/WindowsXP/WinXP Classic black/Tupfile.lua b/skins/_old/WindowsXP/WinXP Classic black/Tupfile.lua new file mode 100644 index 0000000000..16edc2b7b0 --- /dev/null +++ b/skins/_old/WindowsXP/WinXP Classic black/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("WinXP_Classic_black.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "WinXP Classic black.skn") diff --git a/skins/_old/WindowsXP/WinXP Classic blue/Tupfile.lua b/skins/_old/WindowsXP/WinXP Classic blue/Tupfile.lua new file mode 100644 index 0000000000..7c24b139a7 --- /dev/null +++ b/skins/_old/WindowsXP/WinXP Classic blue/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("WinXP_Classic_blue.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "WinXP Classic blue.skn") diff --git a/skins/_old/WindowsXP/WinXP Classic green/Tupfile.lua b/skins/_old/WindowsXP/WinXP Classic green/Tupfile.lua new file mode 100644 index 0000000000..7fa7e7bab8 --- /dev/null +++ b/skins/_old/WindowsXP/WinXP Classic green/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("WinXP_Classic_green.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "WinXP Classic green.skn") diff --git a/skins/_old/WindowsXP/WinXP Classic orange/Tupfile.lua b/skins/_old/WindowsXP/WinXP Classic orange/Tupfile.lua new file mode 100644 index 0000000000..ce9fc80ed5 --- /dev/null +++ b/skins/_old/WindowsXP/WinXP Classic orange/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("WinXP_Classic_orange.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "WinXP Classic orange.skn") diff --git a/skins/_old/WindowsXP/WinXP Classic pink/Tupfile.lua b/skins/_old/WindowsXP/WinXP Classic pink/Tupfile.lua new file mode 100644 index 0000000000..17b0526ad1 --- /dev/null +++ b/skins/_old/WindowsXP/WinXP Classic pink/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("WinXP_Classic_pink.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "WinXP Classic pink.skn") diff --git a/skins/_old/WindowsXP/WinXP Classic red/Tupfile.lua b/skins/_old/WindowsXP/WinXP Classic red/Tupfile.lua new file mode 100644 index 0000000000..e67ae875e7 --- /dev/null +++ b/skins/_old/WindowsXP/WinXP Classic red/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("WinXP_Classic_red.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "WinXP Classic red.skn") diff --git a/skins/_old/WindowsXP/WinXP Classic violet/Tupfile.lua b/skins/_old/WindowsXP/WinXP Classic violet/Tupfile.lua new file mode 100644 index 0000000000..66a80445a9 --- /dev/null +++ b/skins/_old/WindowsXP/WinXP Classic violet/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("WinXP_Classic_violet.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "WinXP Classic violet.skn") diff --git a/skins/_old/WindowsXP/WinXP Classic yellow/Tupfile.lua b/skins/_old/WindowsXP/WinXP Classic yellow/Tupfile.lua new file mode 100644 index 0000000000..487c021e25 --- /dev/null +++ b/skins/_old/WindowsXP/WinXP Classic yellow/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("WinXP_Classic_yellow.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "WinXP Classic yellow.skn") diff --git a/skins/_old/WindowsXP/WinXP Standard blue/Tupfile.lua b/skins/_old/WindowsXP/WinXP Standard blue/Tupfile.lua new file mode 100644 index 0000000000..a49a8a3248 --- /dev/null +++ b/skins/_old/WindowsXP/WinXP Standard blue/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("WinXP_blue.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "WinXP Standard blue.skn") diff --git a/skins/_old/WindowsXP/WinXP Standard olive_green/Tupfile.lua b/skins/_old/WindowsXP/WinXP Standard olive_green/Tupfile.lua new file mode 100644 index 0000000000..6bcbd50f8f --- /dev/null +++ b/skins/_old/WindowsXP/WinXP Standard olive_green/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("WinXP_olive_green.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "WinXP Standard olive_green.skn") diff --git a/skins/_old/WindowsXP/WinXP Standard silver/Tupfile.lua b/skins/_old/WindowsXP/WinXP Standard silver/Tupfile.lua new file mode 100644 index 0000000000..55dc92da95 --- /dev/null +++ b/skins/_old/WindowsXP/WinXP Standard silver/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("WinXP_silver.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "WinXP Standard silver.skn") diff --git a/skins/_old/bat/Tupfile.lua b/skins/_old/bat/Tupfile.lua new file mode 100644 index 0000000000..6535448e0a --- /dev/null +++ b/skins/_old/bat/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "bat.skn") diff --git a/skins/_old/bat/default.skn b/skins/_old/bat/default.skn deleted file mode 100644 index 3e25d8476c..0000000000 Binary files a/skins/_old/bat/default.skn and /dev/null differ diff --git a/skins/_old/black-glass/black-glass/Tupfile.lua b/skins/_old/black-glass/black-glass/Tupfile.lua new file mode 100644 index 0000000000..55efcedb28 --- /dev/null +++ b/skins/_old/black-glass/black-glass/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("black-glass.ASM", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "black-glass.skn") diff --git a/skins/_old/black-glass/black-glass_light/Tupfile.lua b/skins/_old/black-glass/black-glass_light/Tupfile.lua new file mode 100644 index 0000000000..04e674d0bd --- /dev/null +++ b/skins/_old/black-glass/black-glass_light/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("black-glass_light.ASM", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "black-glass_light.skn") diff --git a/skins/_old/blackskin/Tupfile.lua b/skins/_old/blackskin/Tupfile.lua new file mode 100644 index 0000000000..be45bac4ae --- /dev/null +++ b/skins/_old/blackskin/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "blackskin.skn") diff --git a/skins/_old/blackskin/default.skn b/skins/_old/blackskin/default.skn deleted file mode 100644 index c21146e661..0000000000 Binary files a/skins/_old/blackskin/default.skn and /dev/null differ diff --git a/skins/_old/cherry/Tupfile.lua b/skins/_old/cherry/Tupfile.lua new file mode 100644 index 0000000000..26ab1dacf9 --- /dev/null +++ b/skins/_old/cherry/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "cherry.skn") diff --git a/skins/_old/cherry/default.skn b/skins/_old/cherry/default.skn deleted file mode 100644 index 01d9fcbc02..0000000000 Binary files a/skins/_old/cherry/default.skn and /dev/null differ diff --git a/skins/_old/dark_night/Tupfile.lua b/skins/_old/dark_night/Tupfile.lua new file mode 100644 index 0000000000..0ec6400b4e --- /dev/null +++ b/skins/_old/dark_night/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "dark_night.skn") diff --git a/skins/_old/falloutskn/Tupfile.lua b/skins/_old/falloutskn/Tupfile.lua new file mode 100644 index 0000000000..5cc8bcddd5 --- /dev/null +++ b/skins/_old/falloutskn/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "falloutskn.skn") diff --git a/skins/_old/falloutskn/default.skn b/skins/_old/falloutskn/default.skn deleted file mode 100644 index 2d822ca541..0000000000 Binary files a/skins/_old/falloutskn/default.skn and /dev/null differ diff --git a/skins/_old/first_skin/Tupfile.lua b/skins/_old/first_skin/Tupfile.lua new file mode 100644 index 0000000000..823d88018e --- /dev/null +++ b/skins/_old/first_skin/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "first_skin.skn") diff --git a/skins/_old/gliteskin/gliteskin_deepsky/Tupfile.lua b/skins/_old/gliteskin/gliteskin_deepsky/Tupfile.lua new file mode 100644 index 0000000000..c25a4530be --- /dev/null +++ b/skins/_old/gliteskin/gliteskin_deepsky/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "gliteskin_deepsky.skn") diff --git a/skins/_old/gliteskin/gliteskin_deepsky/default.skn b/skins/_old/gliteskin/gliteskin_deepsky/default.skn deleted file mode 100644 index c36d366b63..0000000000 Binary files a/skins/_old/gliteskin/gliteskin_deepsky/default.skn and /dev/null differ diff --git a/skins/_old/gliteskin/gliteskin_glider/Tupfile.lua b/skins/_old/gliteskin/gliteskin_glider/Tupfile.lua new file mode 100644 index 0000000000..840f8d6f99 --- /dev/null +++ b/skins/_old/gliteskin/gliteskin_glider/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "gliteskin_glider.skn") diff --git a/skins/_old/gliteskin/gliteskin_glider/default.skn b/skins/_old/gliteskin/gliteskin_glider/default.skn deleted file mode 100644 index f87f8968cd..0000000000 Binary files a/skins/_old/gliteskin/gliteskin_glider/default.skn and /dev/null differ diff --git a/skins/_old/gliteskin/gliteskin_red/Tupfile.lua b/skins/_old/gliteskin/gliteskin_red/Tupfile.lua new file mode 100644 index 0000000000..dd291f85fa --- /dev/null +++ b/skins/_old/gliteskin/gliteskin_red/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "gliteskin_red.skn") diff --git a/skins/_old/gliteskin/gliteskin_red/default.skn b/skins/_old/gliteskin/gliteskin_red/default.skn deleted file mode 100644 index f1e22845f8..0000000000 Binary files a/skins/_old/gliteskin/gliteskin_red/default.skn and /dev/null differ diff --git a/skins/_old/gnome_style/gnome_blue/Tupfile.lua b/skins/_old/gnome_style/gnome_blue/Tupfile.lua new file mode 100644 index 0000000000..b1ddb8b97f --- /dev/null +++ b/skins/_old/gnome_style/gnome_blue/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "gnome_blue.skn") diff --git a/skins/_old/gnome_style/gnome_green/Tupfile.lua b/skins/_old/gnome_style/gnome_green/Tupfile.lua new file mode 100644 index 0000000000..9313496a0e --- /dev/null +++ b/skins/_old/gnome_style/gnome_green/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "gnome_green.skn") diff --git a/skins/_old/gnome_style/gnome_ocean/Tupfile.lua b/skins/_old/gnome_style/gnome_ocean/Tupfile.lua new file mode 100644 index 0000000000..580e4fb558 --- /dev/null +++ b/skins/_old/gnome_style/gnome_ocean/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "gnome_ocean.skn") diff --git a/skins/_old/gnome_style/gnome_olive/Tupfile.lua b/skins/_old/gnome_style/gnome_olive/Tupfile.lua new file mode 100644 index 0000000000..909a99164e --- /dev/null +++ b/skins/_old/gnome_style/gnome_olive/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "gnome_olive.skn") diff --git a/skins/_old/gnome_style/gnome_orange/Tupfile.lua b/skins/_old/gnome_style/gnome_orange/Tupfile.lua new file mode 100644 index 0000000000..6cb16ebf01 --- /dev/null +++ b/skins/_old/gnome_style/gnome_orange/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "gnome_orange.skn") diff --git a/skins/_old/gnome_style/gnome_red/Tupfile.lua b/skins/_old/gnome_style/gnome_red/Tupfile.lua new file mode 100644 index 0000000000..de3f475a8b --- /dev/null +++ b/skins/_old/gnome_style/gnome_red/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "gnome_red.skn") diff --git a/skins/_old/humanoid_OSX/Humanoid_OSX_dark/Tupfile.lua b/skins/_old/humanoid_OSX/Humanoid_OSX_dark/Tupfile.lua new file mode 100644 index 0000000000..b9b8d839ba --- /dev/null +++ b/skins/_old/humanoid_OSX/Humanoid_OSX_dark/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Humanoid_OSX_dark.skn") diff --git a/skins/_old/humanoid_OSX/Humanoid_OSX_dark/default.skn b/skins/_old/humanoid_OSX/Humanoid_OSX_dark/default.skn deleted file mode 100644 index 88b1e683bb..0000000000 Binary files a/skins/_old/humanoid_OSX/Humanoid_OSX_dark/default.skn and /dev/null differ diff --git a/skins/_old/humanoid_OSX/Humanoid_OSX_dark_night/Tupfile.lua b/skins/_old/humanoid_OSX/Humanoid_OSX_dark_night/Tupfile.lua new file mode 100644 index 0000000000..00aa4a68b6 --- /dev/null +++ b/skins/_old/humanoid_OSX/Humanoid_OSX_dark_night/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Humanoid_OSX_dark_night.skn") diff --git a/skins/_old/humanoid_OSX/Humanoid_OSX_dark_night/default.skn b/skins/_old/humanoid_OSX/Humanoid_OSX_dark_night/default.skn deleted file mode 100644 index db0dd53b60..0000000000 Binary files a/skins/_old/humanoid_OSX/Humanoid_OSX_dark_night/default.skn and /dev/null differ diff --git a/skins/_old/humanoid_OSX/humanoid_OSX_blue/Tupfile.lua b/skins/_old/humanoid_OSX/humanoid_OSX_blue/Tupfile.lua new file mode 100644 index 0000000000..6d6327d269 --- /dev/null +++ b/skins/_old/humanoid_OSX/humanoid_OSX_blue/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "humanoid_OSX_blue.skn") diff --git a/skins/_old/humanoid_OSX/humanoid_OSX_green/Tupfile.lua b/skins/_old/humanoid_OSX/humanoid_OSX_green/Tupfile.lua new file mode 100644 index 0000000000..e6435cf6a2 --- /dev/null +++ b/skins/_old/humanoid_OSX/humanoid_OSX_green/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "humanoid_OSX_green.skn") diff --git a/skins/_old/humanoid_OSX/humanoid_OSX_orange/Tupfile.lua b/skins/_old/humanoid_OSX/humanoid_OSX_orange/Tupfile.lua new file mode 100644 index 0000000000..2aaf378c16 --- /dev/null +++ b/skins/_old/humanoid_OSX/humanoid_OSX_orange/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "humanoid_OSX_orange.skn") diff --git a/skins/_old/humanoid_OSX/humanoid_OSX_red/Tupfile.lua b/skins/_old/humanoid_OSX/humanoid_OSX_red/Tupfile.lua new file mode 100644 index 0000000000..4f38c5f77d --- /dev/null +++ b/skins/_old/humanoid_OSX/humanoid_OSX_red/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "humanoid_OSX_red.skn") diff --git a/skins/_old/humanoid_OSX/humanoid_OSX_yellow/Tupfile.lua b/skins/_old/humanoid_OSX/humanoid_OSX_yellow/Tupfile.lua new file mode 100644 index 0000000000..3c2cce2893 --- /dev/null +++ b/skins/_old/humanoid_OSX/humanoid_OSX_yellow/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "humanoid_OSX_yellow.skn") diff --git a/skins/_old/khrome2/Tupfile.lua b/skins/_old/khrome2/Tupfile.lua new file mode 100644 index 0000000000..2c4df40932 --- /dev/null +++ b/skins/_old/khrome2/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "khrome2.skn") diff --git a/skins/_old/lightskin/Tupfile.lua b/skins/_old/lightskin/Tupfile.lua new file mode 100644 index 0000000000..b424037da6 --- /dev/null +++ b/skins/_old/lightskin/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "lightskin.skn") diff --git a/skins/_old/lightskin/default.skn b/skins/_old/lightskin/default.skn deleted file mode 100644 index eb84e88085..0000000000 Binary files a/skins/_old/lightskin/default.skn and /dev/null differ diff --git a/skins/_old/macos_l/Tupfile.lua b/skins/_old/macos_l/Tupfile.lua new file mode 100644 index 0000000000..ab8bb6a125 --- /dev/null +++ b/skins/_old/macos_l/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "macos_l.skn") diff --git a/skins/_old/macos_l/default.skn b/skins/_old/macos_l/default.skn deleted file mode 100644 index 7ef652cb11..0000000000 Binary files a/skins/_old/macos_l/default.skn and /dev/null differ diff --git a/skins/_old/mage-scroll/Tupfile.lua b/skins/_old/mage-scroll/Tupfile.lua new file mode 100644 index 0000000000..3d777d20da --- /dev/null +++ b/skins/_old/mage-scroll/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "mage-scroll.skn") diff --git a/skins/_old/mage-slot/Tupfile.lua b/skins/_old/mage-slot/Tupfile.lua new file mode 100644 index 0000000000..697941362e --- /dev/null +++ b/skins/_old/mage-slot/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "mage-slot.skn") diff --git a/skins/_old/mage-teckno/Tupfile.lua b/skins/_old/mage-teckno/Tupfile.lua new file mode 100644 index 0000000000..894d04797a --- /dev/null +++ b/skins/_old/mage-teckno/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "mage-teckno.skn") diff --git a/skins/_old/mist/Tupfile.lua b/skins/_old/mist/Tupfile.lua new file mode 100644 index 0000000000..6d440cae82 --- /dev/null +++ b/skins/_old/mist/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "mist.skn") diff --git a/skins/_old/mist/default.skn b/skins/_old/mist/default.skn deleted file mode 100644 index 0a549e7f11..0000000000 Binary files a/skins/_old/mist/default.skn and /dev/null differ diff --git a/skins/_old/mist_color/Tupfile.lua b/skins/_old/mist_color/Tupfile.lua new file mode 100644 index 0000000000..8bba8a1047 --- /dev/null +++ b/skins/_old/mist_color/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "mist_color.skn") diff --git a/skins/_old/mist_color/default.skn b/skins/_old/mist_color/default.skn deleted file mode 100644 index e2355d4829..0000000000 Binary files a/skins/_old/mist_color/default.skn and /dev/null differ diff --git a/skins/_old/mursky/Tupfile.lua b/skins/_old/mursky/Tupfile.lua new file mode 100644 index 0000000000..de4f265f25 --- /dev/null +++ b/skins/_old/mursky/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("mursky.dtp.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "mursky.dtp") +tup.rule({"mursky.asm", extra_inputs = {"mursky.dtp"}}, 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "mursky.skn") diff --git a/skins/_old/mygrey/Tupfile.lua b/skins/_old/mygrey/Tupfile.lua new file mode 100644 index 0000000000..97faab2a2c --- /dev/null +++ b/skins/_old/mygrey/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "mygrey.skn") diff --git a/skins/_old/mygrey/default.skn b/skins/_old/mygrey/default.skn deleted file mode 100644 index afae142477..0000000000 Binary files a/skins/_old/mygrey/default.skn and /dev/null differ diff --git a/skins/_old/myskin1/Tupfile.lua b/skins/_old/myskin1/Tupfile.lua new file mode 100644 index 0000000000..5c3dd43576 --- /dev/null +++ b/skins/_old/myskin1/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "myskin1.skn") diff --git a/skins/_old/myskin2/Tupfile.lua b/skins/_old/myskin2/Tupfile.lua new file mode 100644 index 0000000000..069222a835 --- /dev/null +++ b/skins/_old/myskin2/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "myskin2.skn") diff --git a/skins/_old/myskin3/Tupfile.lua b/skins/_old/myskin3/Tupfile.lua new file mode 100644 index 0000000000..47505c41d8 --- /dev/null +++ b/skins/_old/myskin3/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "myskin3.skn") diff --git a/skins/_old/myskin3/default.skn b/skins/_old/myskin3/default.skn deleted file mode 100644 index 847595ec85..0000000000 Binary files a/skins/_old/myskin3/default.skn and /dev/null differ diff --git a/skins/_old/myskin4/Tupfile.lua b/skins/_old/myskin4/Tupfile.lua new file mode 100644 index 0000000000..8eaadc9ef4 --- /dev/null +++ b/skins/_old/myskin4/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "myskin4.skn") diff --git a/skins/_old/neutral/neutral/Tupfile.lua b/skins/_old/neutral/neutral/Tupfile.lua new file mode 100644 index 0000000000..ff0be2fd3d --- /dev/null +++ b/skins/_old/neutral/neutral/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "neutral.skn") diff --git a/skins/_old/neutral/neutral_blue/Tupfile.lua b/skins/_old/neutral/neutral_blue/Tupfile.lua new file mode 100644 index 0000000000..b0fe0daf1d --- /dev/null +++ b/skins/_old/neutral/neutral_blue/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "neutral_blue.skn") diff --git a/skins/_old/neutral/neutral_green/Tupfile.lua b/skins/_old/neutral/neutral_green/Tupfile.lua new file mode 100644 index 0000000000..1a1df670d6 --- /dev/null +++ b/skins/_old/neutral/neutral_green/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "neutral_green.skn") diff --git a/skins/_old/neutral/neutral_lilac/Tupfile.lua b/skins/_old/neutral/neutral_lilac/Tupfile.lua new file mode 100644 index 0000000000..fa20640670 --- /dev/null +++ b/skins/_old/neutral/neutral_lilac/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "neutral_lilac.skn") diff --git a/skins/_old/night/Tupfile.lua b/skins/_old/night/Tupfile.lua new file mode 100644 index 0000000000..037c11a285 --- /dev/null +++ b/skins/_old/night/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("night.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "night.skn") diff --git a/skins/_old/nix/nix_big/Tupfile.lua b/skins/_old/nix/nix_big/Tupfile.lua new file mode 100644 index 0000000000..19cd6c8fc5 --- /dev/null +++ b/skins/_old/nix/nix_big/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("nix_big.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "nix_big.skn") diff --git a/skins/_old/nix/nix_medium/Tupfile.lua b/skins/_old/nix/nix_medium/Tupfile.lua new file mode 100644 index 0000000000..daf4a249dc --- /dev/null +++ b/skins/_old/nix/nix_medium/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("nix_medium.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "nix_medium.skn") diff --git a/skins/_old/nix/nix_small/Tupfile.lua b/skins/_old/nix/nix_small/Tupfile.lua new file mode 100644 index 0000000000..2df37debb4 --- /dev/null +++ b/skins/_old/nix/nix_small/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("nix_small.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "nix_small.skn") diff --git a/skins/_old/panther/Tupfile.lua b/skins/_old/panther/Tupfile.lua new file mode 100644 index 0000000000..767b7b4853 --- /dev/null +++ b/skins/_old/panther/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "panther.skn") diff --git a/skins/_old/panther/default.skn b/skins/_old/panther/default.skn deleted file mode 100644 index af8f68662e..0000000000 Binary files a/skins/_old/panther/default.skn and /dev/null differ diff --git a/skins/_old/plum/Tupfile.lua b/skins/_old/plum/Tupfile.lua new file mode 100644 index 0000000000..bef574fcaa --- /dev/null +++ b/skins/_old/plum/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "plum.skn") diff --git a/skins/_old/plum/default.skn b/skins/_old/plum/default.skn deleted file mode 100644 index 1e2c7f8aa6..0000000000 Binary files a/skins/_old/plum/default.skn and /dev/null differ diff --git a/skins/_old/sea/Tupfile.lua b/skins/_old/sea/Tupfile.lua new file mode 100644 index 0000000000..2750ed97ce --- /dev/null +++ b/skins/_old/sea/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "sea.skn") diff --git a/skins/_old/sea/sea.skn b/skins/_old/sea/sea.skn deleted file mode 100644 index 676daf32fe..0000000000 Binary files a/skins/_old/sea/sea.skn and /dev/null differ diff --git a/skins/_old/skin_feol/Tupfile.lua b/skins/_old/skin_feol/Tupfile.lua new file mode 100644 index 0000000000..8cb02211bd --- /dev/null +++ b/skins/_old/skin_feol/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "skin_feol.skn") diff --git a/skins/_old/skin_feol_new/Tupfile.lua b/skins/_old/skin_feol_new/Tupfile.lua new file mode 100644 index 0000000000..87ea48cb6b --- /dev/null +++ b/skins/_old/skin_feol_new/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "skin_feol_new.skn") diff --git a/skins/_old/skin_ser/Tupfile.lua b/skins/_old/skin_ser/Tupfile.lua new file mode 100644 index 0000000000..8062c173c7 --- /dev/null +++ b/skins/_old/skin_ser/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "skin_ser.skn") diff --git a/skins/_old/skin_vhl/Tupfile.lua b/skins/_old/skin_vhl/Tupfile.lua new file mode 100644 index 0000000000..8161c2c218 --- /dev/null +++ b/skins/_old/skin_vhl/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "skin_vhl.skn") diff --git a/skins/_old/skin_vhl/default.skn b/skins/_old/skin_vhl/default.skn deleted file mode 100644 index 801acc9428..0000000000 Binary files a/skins/_old/skin_vhl/default.skn and /dev/null differ diff --git a/skins/_old/sshock/Tupfile.lua b/skins/_old/sshock/Tupfile.lua new file mode 100644 index 0000000000..4339f55bb4 --- /dev/null +++ b/skins/_old/sshock/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "sshock.skn") diff --git a/skins/_old/sshock/default.skn b/skins/_old/sshock/default.skn deleted file mode 100644 index e7be5c5de2..0000000000 Binary files a/skins/_old/sshock/default.skn and /dev/null differ diff --git a/skins/_old/stone/Tupfile.lua b/skins/_old/stone/Tupfile.lua new file mode 100644 index 0000000000..70a536b5ea --- /dev/null +++ b/skins/_old/stone/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("O'stone.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "stone.skn") diff --git a/skins/_old/subsilv/Tupfile.lua b/skins/_old/subsilv/Tupfile.lua new file mode 100644 index 0000000000..5554b499bf --- /dev/null +++ b/skins/_old/subsilv/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "subsilv.skn") diff --git a/skins/_old/testtest/Tupfile.lua b/skins/_old/testtest/Tupfile.lua new file mode 100644 index 0000000000..29bb3ca201 --- /dev/null +++ b/skins/_old/testtest/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("testtest.dtp.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "testtest.dtp") +tup.rule({"testtest.asm", extra_inputs = {"testtest.dtp"}}, 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "testtest.skn") diff --git a/skins/_old/vista/Tupfile.lua b/skins/_old/vista/Tupfile.lua new file mode 100644 index 0000000000..d4c9a27464 --- /dev/null +++ b/skins/_old/vista/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "vista.skn") diff --git a/skins/_old/win8/DEFAULT.SKN b/skins/_old/win8/DEFAULT.SKN deleted file mode 100644 index 94034e3357..0000000000 Binary files a/skins/_old/win8/DEFAULT.SKN and /dev/null differ diff --git a/skins/_old/win8/Tupfile.lua b/skins/_old/win8/Tupfile.lua new file mode 100644 index 0000000000..3bd6ad9737 --- /dev/null +++ b/skins/_old/win8/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("Default.skn.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "win8.skn") diff --git a/skins/_old/win8/BASE.BMP b/skins/_old/win8/base.bmp similarity index 100% rename from skins/_old/win8/BASE.BMP rename to skins/_old/win8/base.bmp diff --git a/skins/_old/win8/BASE_1.BMP b/skins/_old/win8/base_1.bmp similarity index 100% rename from skins/_old/win8/BASE_1.BMP rename to skins/_old/win8/base_1.bmp diff --git a/skins/_old/win8/LEFT.BMP b/skins/_old/win8/left.bmp similarity index 100% rename from skins/_old/win8/LEFT.BMP rename to skins/_old/win8/left.bmp diff --git a/skins/_old/win8/LEFT_1.BMP b/skins/_old/win8/left_1.bmp similarity index 100% rename from skins/_old/win8/LEFT_1.BMP rename to skins/_old/win8/left_1.bmp diff --git a/skins/_old/win8/ME_SKIN.INC b/skins/_old/win8/me_skin.inc similarity index 100% rename from skins/_old/win8/ME_SKIN.INC rename to skins/_old/win8/me_skin.inc diff --git a/skins/_old/win8/OPER.BMP b/skins/_old/win8/oper.bmp similarity index 100% rename from skins/_old/win8/OPER.BMP rename to skins/_old/win8/oper.bmp diff --git a/skins/_old/win8/OPER_1.BMP b/skins/_old/win8/oper_1.bmp similarity index 100% rename from skins/_old/win8/OPER_1.BMP rename to skins/_old/win8/oper_1.bmp diff --git a/skins/_old/winflat/Tupfile.lua b/skins/_old/winflat/Tupfile.lua new file mode 100644 index 0000000000..a7565273ca --- /dev/null +++ b/skins/_old/winflat/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("default.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "winflat.skn") diff --git a/skins/_old/zRiver/zRiver1/Tupfile.lua b/skins/_old/zRiver/zRiver1/Tupfile.lua new file mode 100644 index 0000000000..e9ca753c37 --- /dev/null +++ b/skins/_old/zRiver/zRiver1/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("zRiver1.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "zRiver1.skn") diff --git a/skins/_old/zRiver/zRiver2/Tupfile.lua b/skins/_old/zRiver/zRiver2/Tupfile.lua new file mode 100644 index 0000000000..4f7c8dc26c --- /dev/null +++ b/skins/_old/zRiver/zRiver2/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("zRiver2.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "zRiver2.skn") diff --git a/skins/_old/zRiver/zRiver3/Tupfile.lua b/skins/_old/zRiver/zRiver3/Tupfile.lua new file mode 100644 index 0000000000..5c62148bde --- /dev/null +++ b/skins/_old/zRiver/zRiver3/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("zRiver3.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "zRiver3.skn") diff --git a/skins/_old/zRiver/zRiver4/Tupfile.lua b/skins/_old/zRiver/zRiver4/Tupfile.lua new file mode 100644 index 0000000000..c68568c7c4 --- /dev/null +++ b/skins/_old/zRiver/zRiver4/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("zRiver4.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "zRiver4.skn") diff --git a/skins/_old/zRiver/zRiver5/Tupfile.lua b/skins/_old/zRiver/zRiver5/Tupfile.lua new file mode 100644 index 0000000000..de89e59b95 --- /dev/null +++ b/skins/_old/zRiver/zRiver5/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("zRiver5.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "zRiver5.skn") diff --git a/skins/_old/zRiver/zRiver6/Tupfile.lua b/skins/_old/zRiver/zRiver6/Tupfile.lua new file mode 100644 index 0000000000..929e42eca8 --- /dev/null +++ b/skins/_old/zRiver/zRiver6/Tupfile.lua @@ -0,0 +1,2 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("zRiver6.asm", 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "zRiver6.skn") diff --git a/skins/loggy/Tupfile.lua b/skins/loggy/Tupfile.lua new file mode 100644 index 0000000000..6ee0996823 --- /dev/null +++ b/skins/loggy/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.rule("dtp.asm", 'fasm "%f" "%o"', "dtp.dtp") +tup.rule({"default.asm", extra_inputs = {"dtp.dtp"}}, 'fasm "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "loggy.skn") diff --git a/skins/skinlist.lua b/skins/skinlist.lua new file mode 100644 index 0000000000..ea47b99740 --- /dev/null +++ b/skins/skinlist.lua @@ -0,0 +1,184 @@ +-- Provides list of skins for distribution kit, +-- included by ../data/Tupfile.lua. +skinlist = { +"loggy/loggy.skn", +"_old/5imple Alpha/1.5imple Alpha/1.5imple Alpha.skn", +"_old/5imple Alpha/2.5imple Alpha/2.5imple Alpha.skn", +"_old/5imple Alpha/3.5imple Alpha/3.5imple Alpha.skn", +"_old/Arena/Arena.skn", +"_old/bat/bat.skn", +"_old/black-glass/black-glass/black-glass.skn", +"_old/black-glass/black-glass_light/black-glass_light.skn", +"_old/blackskin/blackskin.skn", +"_old/Black_lace/1.Black_lace/1.Black_lace.skn", +"_old/Black_lace/2.Black_lace/2.Black_lace.skn", +"_old/Blended/Blended.skn", +"_old/Brick/1.Brick/1.Brick.skn", +"_old/BrownLustre/BrownLustre/BrownLustre.skn", +"_old/BrownLustre/BrownLustre_2/BrownLustre_2.skn", +"_old/cherry/cherry.skn", +"_old/Circles/1.Circles/1.Circles.skn", +"_old/Circles/2.Circles/2.Circles.skn", +"_old/Circles/3.Circles/3.Circles.skn", +"_old/Circles/4.Circles/4.Circles.skn", +"_old/CodeOpusC/Opus_A/Opus_A.skn", +"_old/CodeOpusC/Opus_B/Opus_B.skn", +"_old/CodeOpusC/Opus_D/Opus_D.skn", +"_old/CodeOpusC/Opus_DA/Opus_DA.skn", +"_old/CodeOpusC/Opus_G/Opus_G.skn", +"_old/Crystal/Crystal.skn", +"_old/Cyclops/1.Cyclops/1.Cyclops.skn", +"_old/Cyclops/2.Cyclops/2.Cyclops.skn", +"_old/Dark_future/Dark_future.skn", +"_old/dark_night/dark_night.skn", +"_old/Devil_skins/Blue_devil/Blue_devil.skn", +"_old/Devil_skins/Green_devil/Green_devil.skn", +"_old/Devil_skins/Pink_devil/Pink_devil.skn", +"_old/Devil_skins/Red_devil/Red_devil.skn", +"_old/Devil_skins/Violet_devil/Violet_devil.skn", +"_old/Eyes/Eyes.skn", +"_old/falloutskn/falloutskn.skn", +"_old/Fever/Fever1 blue/Fever1 blue.skn", +"_old/Fever/Fever1 green/Fever1 green.skn", +"_old/Fever/Fever1 red/Fever1 red.skn", +"_old/Fever/Fever2 blue/Fever2 blue.skn", +"_old/Fever/Fever2 green/Fever2 green.skn", +"_old/Fever/Fever2 red/Fever2 red.skn", +"_old/first_skin/first_skin.skn", +"_old/Flowers/Flowers.skn", +"_old/Flyght/Flyght.skn", +"_old/Glass_lime/Glass_lime.skn", +"_old/gliteskin/gliteskin_deepsky/gliteskin_deepsky.skn", +"_old/gliteskin/gliteskin_glider/gliteskin_glider.skn", +"_old/gliteskin/gliteskin_red/gliteskin_red.skn", +"_old/gnome_style/gnome_blue/gnome_blue.skn", +"_old/gnome_style/gnome_green/gnome_green.skn", +"_old/gnome_style/gnome_ocean/gnome_ocean.skn", +"_old/gnome_style/gnome_olive/gnome_olive.skn", +"_old/gnome_style/gnome_orange/gnome_orange.skn", +"_old/gnome_style/gnome_red/gnome_red.skn", +"_old/Grey/Grey.skn", +"_old/Hearts/Hearts 3d/Hearts 3d.skn", +"_old/Hearts/Hearts flat/Hearts flat.skn", +"_old/humanoid_OSX/humanoid_OSX_blue/humanoid_OSX_blue.skn", +"_old/humanoid_OSX/Humanoid_OSX_dark/Humanoid_OSX_dark.skn", +"_old/humanoid_OSX/Humanoid_OSX_dark_night/Humanoid_OSX_dark_night.skn", +"_old/humanoid_OSX/humanoid_OSX_green/humanoid_OSX_green.skn", +"_old/humanoid_OSX/humanoid_OSX_orange/humanoid_OSX_orange.skn", +"_old/humanoid_OSX/humanoid_OSX_red/humanoid_OSX_red.skn", +"_old/humanoid_OSX/humanoid_OSX_yellow/humanoid_OSX_yellow.skn", +"_old/khrome2/khrome2.skn", +"_old/Leency/AreaO/AreaO.skn", +"_old/Leency/AreaSq/AreaSq.skn", +"_old/Leency/L-Junior/L-Junior.skn", +"_old/Leency/Latte/Latte.skn", +"_old/Leency/Luna/Luna.skn", +"_old/Leency/Octo/Octo.skn", +"_old/Leency/Octo_flat/Octo_flat.skn", +"_old/Leency/OpusN/OpusN.skn", +"_old/Leency/Sandwich/Sandwich.skn", +"_old/Leency/Yeah/Yeah.skn", +"_old/lightskin/lightskin.skn", +"_old/macos_l/macos_l.skn", +"_old/mage-scroll/mage-scroll.skn", +"_old/mage-slot/mage-slot.skn", +"_old/mage-teckno/mage-teckno.skn", +"_old/MenuetOS/1.MenuetOS/2/1.MenuetOS.2.skn", +"_old/MenuetOS/2.MenuetOS/1/2.MenuetOS.1.skn", +"_old/MenuetOS/2.MenuetOS/2/2.MenuetOS.2.skn", +"_old/MenuetOS/3.MenuetOS/1/3.MenuetOS.1.skn", +"_old/MenuetOS/3.MenuetOS/2/3.MenuetOS.2.skn", +"_old/MenuetOS/4.MenuetOS/1/4.MenuetOS.1.skn", +"_old/MenuetOS/4.MenuetOS/2/4.MenuetOS.2.skn", +"_old/MenuetOS/5.MenuetOS/1/5.MenuetOS.1.skn", +"_old/MenuetOS/5.MenuetOS/2/5.MenuetOS.2.skn", +"_old/MetalColor/MCBlue/MCBlue.skn", +"_old/MetalColor/MCRed/MCRed.skn", +"_old/MetalGearArrows/1.MetalGearArrows/1.MetalGearArrows.skn", +"_old/MetalGearArrows/2.MetalGearArrows/2.MetalGearArrows.skn", +"_old/MetalGearArrows/3.MetalGearArrows/3.MetalGearArrows.skn", +"_old/MetalGearArrows/4.MetalGearArrows/4.MetalGearArrows.skn", +"_old/mist/mist.skn", +"_old/mist_color/mist_color.skn", +"_old/mursky/mursky.skn", +"_old/mygrey/mygrey.skn", +"_old/myskin1/myskin1.skn", +"_old/myskin2/myskin2.skn", +"_old/myskin3/myskin3.skn", +"_old/myskin4/myskin4.skn", +"_old/MyTango/MyTango.skn", +"_old/Nature/Nature.skn", +"_old/Nature/Sandwich/src/src.skn", +"_old/neutral/neutral/neutral.skn", +"_old/neutral/neutral_blue/neutral_blue.skn", +"_old/neutral/neutral_green/neutral_green.skn", +"_old/neutral/neutral_lilac/neutral_lilac.skn", +"_old/night/night.skn", +"_old/nix/nix_big/nix_big.skn", +"_old/nix/nix_medium/nix_medium.skn", +"_old/nix/nix_small/nix_small.skn", +"_old/Nova_skins/Nova_blue/Nova_blue.skn", +"_old/Nova_skins/Nova_brown/Nova_brown.skn", +"_old/Nova_skins/Nova_green/Nova_green.skn", +"_old/Nova_skins/Nova_grey/Nova_grey.skn", +"_old/Nova_skins/Nova_pink/Nova_pink.skn", +"_old/Nova_skins/Nova_red/Nova_red.skn", +"_old/Nova_skins/Nova_violet/Nova_violet.skn", +"_old/OpusOs_Blue/OpusOs_Blue.skn", +"_old/Orange_aureole/Orange_aureole.skn", +"_old/Orange_Silence/Orange_Silence.skn", +"_old/Organics/Organics.skn", +"_old/panther/panther.skn", +"_old/plum/plum.skn", +"_old/Rednex/Rednex.skn", +"_old/RoboTech/BRoboTech/BRoboTech.skn", +"_old/RoboTech/GRoboTech/GRoboTech.skn", +"_old/Russia/Russia.skn", +"_old/Sad_grey/Sad_grey.skn", +"_old/SashSkinPack_1_1/Src/Aqua/Aqua.skn", +"_old/SashSkinPack_1_1/Src/Cold/Cold.skn", +"_old/SashSkinPack_1_1/Src/Metal/Metal.skn", +"_old/sea/sea.skn", +"_old/Simple_gray/Simple_gray.skn", +"_old/skin_feol/skin_feol.skn", +"_old/skin_feol_new/skin_feol_new.skn", +"_old/skin_ser/skin_ser.skn", +"_old/skin_vhl/skin_vhl.skn", +"_old/sshock/sshock.skn", +"_old/stone/stone.skn", +"_old/StyleVista/vista/StyleVista_vista.skn", +"_old/StyleVista/vista_basic/vista_basic.skn", +"_old/StyleVista/vista_basic_black/vista_basic_black.skn", +"_old/StyleVista/vista_dark/vista_dark.skn", +"_old/StyleXP/orqua/orqua.skn", +"_old/StyleXP/panther/StyleXP_panther.skn", +"_old/StyleXP/wmpx/wmpx.skn", +"_old/subsilv/subsilv.skn", +"_old/Syllable/Syllable.skn", +"_old/testtest/testtest.skn", +"_old/USSR/USSR.skn", +"_old/USSR_2/1.USSR_2/1.USSR_2.skn", +"_old/USSR_2/2.USSR_2/2.USSR_2.skn", +"_old/Victory_1945/Victory_1945.skn", +"_old/vista/vista.skn", +"_old/WIN311/WIN311.skn", +"_old/win8/win8.skn", +"_old/WindowsXP/WinXP Classic black/WinXP Classic black.skn", +"_old/WindowsXP/WinXP Classic blue/WinXP Classic blue.skn", +"_old/WindowsXP/WinXP Classic green/WinXP Classic green.skn", +"_old/WindowsXP/WinXP Classic orange/WinXP Classic orange.skn", +"_old/WindowsXP/WinXP Classic pink/WinXP Classic pink.skn", +"_old/WindowsXP/WinXP Classic red/WinXP Classic red.skn", +"_old/WindowsXP/WinXP Classic violet/WinXP Classic violet.skn", +"_old/WindowsXP/WinXP Classic yellow/WinXP Classic yellow.skn", +"_old/WindowsXP/WinXP Standard blue/WinXP Standard blue.skn", +"_old/WindowsXP/WinXP Standard olive_green/WinXP Standard olive_green.skn", +"_old/WindowsXP/WinXP Standard silver/WinXP Standard silver.skn", +"_old/winflat/winflat.skn", +"_old/zRiver/zRiver1/zRiver1.skn", +"_old/zRiver/zRiver2/zRiver2.skn", +"_old/zRiver/zRiver3/zRiver3.skn", +"_old/zRiver/zRiver4/zRiver4.skn", +"_old/zRiver/zRiver5/zRiver5.skn", +"_old/zRiver/zRiver6/zRiver6.skn", +} diff --git a/tup.config.template b/tup.config.template new file mode 100644 index 0000000000..0b62c467b5 --- /dev/null +++ b/tup.config.template @@ -0,0 +1,44 @@ +### Copy as tup.config and modify according to your needs. +### tup.config should be in the same directory where you have said "tup init". +### If there are several directories, tup.config-s are independent. + +### Generic configuration +### interface language: en [default], ru, et, it, sp +# CONFIG_LANG=en + +### Installed compilers. +### Setting a variable to any non-empty value +### prevents calls to the corresponding compiler +### and disables build of corresponding binaries. +### The concrete value matters only if CONFIG_BUILD_TYPE is also set; +### "full" means that binaries will be excluded from final images, +### anything other means that you have obtained binaries in some other way +### and still want to have them in final images. +# CONFIG_NO_FASM=full +# CONFIG_NO_NASM=full +# CONFIG_NO_GCC=full +# CONFIG_NO_MSVC=full +# CONFIG_NO_CMM=full + +### Optional postprocessing of binaries, where applicable. +### By default, no postprocessing is used. +### Windows variants +# CONFIG_KPACK_CMD=&& kpack /nologo "%o" +# CONFIG_KERPACK_CMD=&& kerpack %o +# CONFIG_PESTRIP_CMD=&&set EXENAME=%o&&fasm $(ROOT)/data/common/pestrip.asm %o +### Linux variants +# CONFIG_KPACK_CMD=&& kpack --nologo "%o" +# CONFIG_KERPACK_CMD=&& kerpack %o +# CONFIG_PESTRIP_CMD=&& EXENAME=%o fasm $(ROOT)/data/common/pestrip.asm %o + +### BUILD_TYPE, if set, enables building kolibri.img and kolibri.iso. +### Must match subdirectory name in $(ROOT)/data. +### Requires Linux. +# CONFIG_BUILD_TYPE=eng +### If set, injects build date and revision number from data/.revision +### to kernel.mnt to be displayed during boot screen. +# CONFIG_INSERT_REVISION_ID=1 + +### Use for single-program mode, when "tup init" selects +### a directory of one program, as opposed to the entire repository. +# CONFIG_HELPERDIR=.