├── bin ├── .gitignore └── stm32doom.bin ├── .gitignore ├── img ├── keys.png ├── Loading.png └── No USB.png ├── lib ├── stm32 │ ├── stm32f4xx.h │ └── system_stm32f4xx.h ├── fatfs │ ├── integer.h │ ├── fatfs_usbdisk.h │ ├── fatfs.h │ └── diskio.h └── usb │ ├── usbh_conf.h │ ├── usb_msc_host.h │ ├── usb_msc_host.c │ ├── usb_bsp.h │ ├── usb_conf.h │ ├── usbh_usr.h │ └── usb_hcd.h ├── src ├── chocdoom │ ├── statdump.h │ ├── net_dedicated.h │ ├── p_inter.h │ ├── w_main.h │ ├── net_sdl.h │ ├── doomdef.c │ ├── r_segs.h │ ├── w_checksum.h │ ├── i_endoom.h │ ├── net_loop.h │ ├── p_tick.h │ ├── net_gui.h │ ├── p_setup.h │ ├── m_fixed.h │ ├── m_random.h │ ├── r_sky.h │ ├── doomstat.c │ ├── d_textur.h │ ├── f_finale.h │ ├── dstrings.h │ ├── d_items.h │ ├── m_bbox.h │ ├── doomfeatures.h │ ├── i_timer.h │ ├── d_main.h │ ├── i_videohr.h │ ├── net_server.h │ ├── r_local.h │ ├── sha1.h │ ├── m_bbox.c │ ├── memio.h │ ├── wi_stuff.h │ ├── m_config.h │ ├── deh_str.h │ ├── net_io.h │ ├── w_merge.h │ ├── m_fixed.c │ ├── r_sky.c │ ├── m_argv.h │ ├── f_wipe.h │ ├── am_map.h │ ├── r_data.h │ ├── i_cdmus.h │ ├── m_cheat.h │ ├── hu_stuff.h │ ├── r_bsp.h │ ├── i_swap.h │ ├── v_patch.h │ ├── deh_main.h │ ├── net_query.h │ ├── d_event.c │ ├── m_menu.h │ ├── r_plane.h │ ├── d_think.h │ ├── d_ticcmd.h │ ├── i_scale.h │ ├── p_saveg.h │ ├── r_things.h │ ├── net_client.h │ ├── d_iwad.h │ ├── p_pspr.h │ ├── doom.h │ ├── w_wad.h │ ├── i_endoom.c │ ├── m_misc.h │ ├── dummy.c │ ├── g_game.h │ ├── w_file.c │ ├── s_sound.h │ ├── st_stuff.h │ ├── w_file.h │ ├── z_zone.h │ ├── i_system.h │ ├── m_cheat.c │ ├── d_items.c │ ├── w_checksum.c │ ├── dstrings.c │ ├── d_loop.h │ ├── r_draw.h │ ├── i_joystick.h │ ├── tables.h │ ├── doomtype.h │ ├── m_random.c │ ├── i_timer.c │ ├── doomkeys.h │ ├── r_state.h │ ├── config.h │ └── d_mode.h ├── jpeg.h ├── button.h ├── debug.h ├── images.h ├── spi.h ├── sdram.h ├── font.c ├── main.h ├── led.h ├── i2c.h ├── touch.h ├── font.h ├── lcd.h ├── button.c └── led.c ├── README └── memory.ld /bin/.gitignore: -------------------------------------------------------------------------------- 1 | *.elf 2 | *.lss 3 | *.map 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | bin/ 2 | *.project 3 | *.cproject 4 | *.settings -------------------------------------------------------------------------------- /img/keys.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/floppes/stm32doom/HEAD/img/keys.png -------------------------------------------------------------------------------- /img/Loading.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/floppes/stm32doom/HEAD/img/Loading.png -------------------------------------------------------------------------------- /img/No USB.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/floppes/stm32doom/HEAD/img/No USB.png -------------------------------------------------------------------------------- /bin/stm32doom.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/floppes/stm32doom/HEAD/bin/stm32doom.bin -------------------------------------------------------------------------------- /lib/stm32/stm32f4xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/floppes/stm32doom/HEAD/lib/stm32/stm32f4xx.h -------------------------------------------------------------------------------- /src/chocdoom/statdump.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright(C) 2005-2014 Simon Howard 4 | 5 | This program is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | as published by the Free Software Foundation; either version 2 8 | of the License, or (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | */ 16 | 17 | #ifndef DOOM_STATDUMP_H 18 | #define DOOM_STATDUMP_H 19 | 20 | void StatCopy(wbstartstruct_t *stats); 21 | void StatDump(void); 22 | 23 | #endif /* #ifndef DOOM_STATDUMP_H */ 24 | -------------------------------------------------------------------------------- /src/chocdoom/net_dedicated.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 2005-2014 Simon Howard 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // 15 | // Dedicated server code. 16 | // 17 | 18 | #ifndef NET_DEDICATED_H 19 | #define NET_DEDICATED_H 20 | 21 | void NET_DedicatedServer(void); 22 | 23 | #endif /* #ifndef NET_DEDICATED_H */ 24 | 25 | 26 | -------------------------------------------------------------------------------- /lib/fatfs/integer.h: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------*/ 2 | /* Integer type definitions for FatFs module */ 3 | /*-------------------------------------------*/ 4 | 5 | #ifndef _FF_INTEGER 6 | #define _FF_INTEGER 7 | 8 | #ifdef _WIN32 /* FatFs development platform */ 9 | 10 | #include 11 | #include 12 | 13 | #else /* Embedded platform */ 14 | 15 | #include 16 | 17 | /* This type MUST be 8 bit */ 18 | typedef uint8_t BYTE; 19 | 20 | /* These types MUST be 16 bit */ 21 | typedef int16_t SHORT; 22 | typedef uint16_t WORD; 23 | typedef uint16_t WCHAR; 24 | 25 | /* These types MUST be 16 bit or 32 bit */ 26 | typedef int32_t INT; 27 | typedef uint32_t UINT; 28 | 29 | /* These types MUST be 32 bit */ 30 | typedef int32_t LONG; 31 | typedef uint32_t DWORD; 32 | 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/chocdoom/p_inter.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // 17 | // 18 | 19 | 20 | #ifndef __P_INTER__ 21 | #define __P_INTER__ 22 | 23 | 24 | 25 | 26 | boolean P_GivePower(player_t*, int); 27 | 28 | 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /src/chocdoom/w_main.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 2005-2014 Simon Howard 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // DESCRIPTION: 15 | // Common code to parse command line, identifying WAD files to load. 16 | // 17 | 18 | #ifndef W_MAIN_H 19 | #define W_MAIN_H 20 | 21 | boolean W_ParseCommandLine(void); 22 | 23 | #endif /* #ifndef W_MAIN_H */ 24 | 25 | -------------------------------------------------------------------------------- /src/chocdoom/net_sdl.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 2005-2014 Simon Howard 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // DESCRIPTION: 15 | // Networking module which uses SDL_net 16 | // 17 | 18 | #ifndef NET_SDL_H 19 | #define NET_SDL_H 20 | 21 | #include "net_defs.h" 22 | 23 | extern net_module_t net_sdl_module; 24 | 25 | #endif /* #ifndef NET_SDL_H */ 26 | 27 | -------------------------------------------------------------------------------- /src/chocdoom/doomdef.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // DoomDef - basic defines for DOOM, e.g. Version, game mode 17 | // and skill level, and display parameters. 18 | // 19 | 20 | 21 | 22 | #include "doomdef.h" 23 | 24 | // Location for any defines turned variables. 25 | 26 | // None. 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/chocdoom/r_segs.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Refresh module, drawing LineSegs from BSP. 17 | // 18 | 19 | 20 | #ifndef __R_SEGS__ 21 | #define __R_SEGS__ 22 | 23 | 24 | 25 | 26 | void 27 | R_RenderMaskedSegRange 28 | ( drawseg_t* ds, 29 | int x1, 30 | int x2 ); 31 | 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/chocdoom/w_checksum.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Generate a checksum of the WAD directory. 17 | // 18 | 19 | #ifndef W_CHECKSUM_H 20 | #define W_CHECKSUM_H 21 | 22 | #include "doomtype.h" 23 | 24 | extern void W_Checksum(sha1_digest_t digest); 25 | 26 | #endif /* #ifndef W_CHECKSUM_H */ 27 | 28 | -------------------------------------------------------------------------------- /src/chocdoom/i_endoom.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Exit text-mode ENDOOM screen. 17 | // 18 | 19 | 20 | #ifndef __I_ENDOOM__ 21 | #define __I_ENDOOM__ 22 | 23 | // Display the Endoom screen on shutdown. Pass a pointer to the 24 | // ENDOOM lump. 25 | 26 | void I_Endoom(byte *data); 27 | 28 | #endif 29 | 30 | -------------------------------------------------------------------------------- /src/chocdoom/net_loop.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 2005-2014 Simon Howard 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // DESCRIPTION: 15 | // Loopback network module for server compiled into the client 16 | // 17 | 18 | #ifndef NET_LOOP_H 19 | #define NET_LOOP_H 20 | 21 | #include "net_defs.h" 22 | 23 | extern net_module_t net_loop_client_module; 24 | extern net_module_t net_loop_server_module; 25 | 26 | #endif /* #ifndef NET_LOOP_H */ 27 | 28 | -------------------------------------------------------------------------------- /src/chocdoom/p_tick.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // ? 17 | // 18 | 19 | 20 | #ifndef __P_TICK__ 21 | #define __P_TICK__ 22 | 23 | 24 | 25 | 26 | // Called by C_Ticker, 27 | // can call G_PlayerExited. 28 | // Carries out all thinking of monsters and players. 29 | void P_Ticker (void); 30 | 31 | 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/chocdoom/net_gui.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 2005-2014 Simon Howard 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // Graphical stuff related to the networking code: 15 | // 16 | // * The client waiting screen when we are waiting for the server to 17 | // start the game. 18 | // 19 | 20 | 21 | #ifndef NET_GUI_H 22 | #define NET_GUI_H 23 | 24 | #include "doomtype.h" 25 | 26 | extern void NET_WaitForLaunch(void); 27 | 28 | #endif /* #ifndef NET_GUI_H */ 29 | 30 | -------------------------------------------------------------------------------- /src/chocdoom/p_setup.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Setup a game, startup stuff. 17 | // 18 | 19 | 20 | #ifndef __P_SETUP__ 21 | #define __P_SETUP__ 22 | 23 | 24 | 25 | 26 | // NOT called by W_Ticker. Fixme. 27 | void 28 | P_SetupLevel 29 | ( int episode, 30 | int map, 31 | int playermask, 32 | skill_t skill); 33 | 34 | // Called by startup code. 35 | void P_Init (void); 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /src/chocdoom/m_fixed.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Fixed point arithemtics, implementation. 17 | // 18 | 19 | 20 | #ifndef __M_FIXED__ 21 | #define __M_FIXED__ 22 | 23 | 24 | 25 | 26 | // 27 | // Fixed point, 32bit as 16.16. 28 | // 29 | #define FRACBITS 16 30 | #define FRACUNIT (1< 20 | 21 | #include "doomstat.h" 22 | 23 | 24 | // Game Mode - identify IWAD as shareware, retail etc. 25 | GameMode_t gamemode = indetermined; 26 | GameMission_t gamemission = doom; 27 | GameVersion_t gameversion = exe_final2; 28 | char *gamedescription; 29 | 30 | // Set if homebrew PWAD stuff has been added. 31 | boolean modifiedgame; 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/chocdoom/d_textur.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Typedefs related to to textures etc., 17 | // isolated here to make it easier separating modules. 18 | // 19 | 20 | 21 | #ifndef __D_TEXTUR__ 22 | #define __D_TEXTUR__ 23 | 24 | #include "doomtype.h" 25 | 26 | 27 | 28 | 29 | // 30 | // Flats? 31 | // 32 | // a pic is an unmasked block of pixels 33 | typedef struct 34 | { 35 | byte width; 36 | byte height; 37 | byte data; 38 | } pic_t; 39 | 40 | 41 | 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/chocdoom/f_finale.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // 17 | // 18 | 19 | 20 | #ifndef __F_FINALE__ 21 | #define __F_FINALE__ 22 | 23 | 24 | #include "doomtype.h" 25 | #include "d_event.h" 26 | // 27 | // FINALE 28 | // 29 | 30 | // Called by main loop. 31 | boolean F_Responder (event_t* ev); 32 | 33 | // Called by main loop. 34 | void F_Ticker (void); 35 | 36 | // Called by main loop. 37 | void F_Drawer (void); 38 | 39 | 40 | void F_StartFinale (void); 41 | 42 | 43 | 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/chocdoom/dstrings.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // 16 | // DESCRIPTION: 17 | // DOOM strings, by language. 18 | // 19 | 20 | 21 | #ifndef __DSTRINGS__ 22 | #define __DSTRINGS__ 23 | 24 | 25 | // All important printed strings. 26 | 27 | #include "d_englsh.h" 28 | 29 | // Misc. other strings. 30 | #define SAVEGAMENAME "doomsav" 31 | 32 | 33 | // QuitDOOM messages 34 | // 8 per each game type 35 | #define NUM_QUITMESSAGES 8 36 | 37 | extern char *doom1_endmsg[]; 38 | extern char *doom2_endmsg[]; 39 | 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/chocdoom/d_items.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Items: key cards, artifacts, weapon, ammunition. 17 | // 18 | 19 | 20 | #ifndef __D_ITEMS__ 21 | #define __D_ITEMS__ 22 | 23 | #include "doomdef.h" 24 | 25 | 26 | 27 | // Weapon info: sprite frames, ammunition use. 28 | typedef struct 29 | { 30 | ammotype_t ammo; 31 | int upstate; 32 | int downstate; 33 | int readystate; 34 | int atkstate; 35 | int flashstate; 36 | 37 | } weaponinfo_t; 38 | 39 | extern weaponinfo_t weaponinfo[NUMWEAPONS]; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/chocdoom/m_bbox.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Nil. 17 | // 18 | 19 | 20 | #ifndef __M_BBOX__ 21 | #define __M_BBOX__ 22 | 23 | #include 24 | 25 | #include "m_fixed.h" 26 | 27 | 28 | // Bounding box coordinate storage. 29 | enum 30 | { 31 | BOXTOP, 32 | BOXBOTTOM, 33 | BOXLEFT, 34 | BOXRIGHT 35 | }; // bbox coordinates 36 | 37 | // Bounding box functions. 38 | void M_ClearBox (fixed_t* box); 39 | 40 | void 41 | M_AddToBox 42 | ( fixed_t* box, 43 | fixed_t x, 44 | fixed_t y ); 45 | 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/chocdoom/doomfeatures.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 2005-2014 Simon Howard 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // DESCRIPTION: 15 | // List of features which can be enabled/disabled to slim down the 16 | // program. 17 | // 18 | 19 | #ifndef DOOM_FEATURES_H 20 | #define DOOM_FEATURES_H 21 | 22 | // Enables wad merging (the '-merge' command line parameter) 23 | 24 | #undef FEATURE_WAD_MERGE 25 | 26 | // Enables dehacked support ('-deh') 27 | 28 | #undef FEATURE_DEHACKED 29 | 30 | // Enables multiplayer support (network games) 31 | 32 | #undef FEATURE_MULTIPLAYER 33 | 34 | // Enables sound output 35 | 36 | #undef FEATURE_SOUND 37 | 38 | #endif /* #ifndef DOOM_FEATURES_H */ 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/chocdoom/i_timer.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // System-specific timer interface 17 | // 18 | 19 | 20 | #ifndef __I_TIMER__ 21 | #define __I_TIMER__ 22 | 23 | #define TICRATE 35 24 | 25 | // Called by D_DoomLoop, 26 | // returns current time in tics. 27 | int I_GetTime (void); 28 | 29 | // returns current time in ms 30 | int I_GetTimeMS (void); 31 | 32 | // Pause for a specified number of ms 33 | void I_Sleep(int ms); 34 | 35 | // Initialize timer 36 | void I_InitTimer(void); 37 | 38 | // Wait for vertical retrace or pause a bit. 39 | void I_WaitVBL(int count); 40 | 41 | #endif 42 | 43 | -------------------------------------------------------------------------------- /src/chocdoom/d_main.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // System specific interface stuff. 17 | // 18 | 19 | 20 | #ifndef __D_MAIN__ 21 | #define __D_MAIN__ 22 | 23 | #include "doomdef.h" 24 | 25 | 26 | 27 | 28 | // Read events from all input devices 29 | 30 | void D_ProcessEvents (void); 31 | 32 | 33 | // 34 | // BASE LEVEL 35 | // 36 | void D_PageTicker (void); 37 | void D_PageDrawer (void); 38 | void D_AdvanceDemo (void); 39 | void D_DoAdvanceDemo (void); 40 | void D_StartTitle (void); 41 | 42 | // 43 | // GLOBAL VARIABLES 44 | // 45 | 46 | extern gameaction_t gameaction; 47 | 48 | 49 | #endif 50 | 51 | -------------------------------------------------------------------------------- /src/chocdoom/i_videohr.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 2005-2014 Simon Howard 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // DESCRIPTION: 15 | // SDL emulation of VGA 640x480x4 planar video mode, 16 | // for Hexen startup loading screen. 17 | // 18 | 19 | #ifndef I_VIDEOHR_H 20 | #define I_VIDEOHR_H 21 | 22 | boolean I_SetVideoModeHR(void); 23 | void I_UnsetVideoModeHR(void); 24 | void I_SetWindowTitleHR(char *title); 25 | void I_ClearScreenHR(void); 26 | void I_SlamBlockHR(int x, int y, int w, int h, const byte *src); 27 | void I_SlamHR(const byte *buffer); 28 | void I_InitPaletteHR(void); 29 | void I_SetPaletteHR(const byte *palette); 30 | void I_FadeToPaletteHR(const byte *palette); 31 | void I_BlackPaletteHR(void); 32 | boolean I_CheckAbortHR(void); 33 | 34 | #endif /* #ifndef I_VIDEOHR_H */ 35 | 36 | -------------------------------------------------------------------------------- /src/chocdoom/net_server.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 2005-2014 Simon Howard 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // Network server code 15 | // 16 | 17 | #ifndef NET_SERVER_H 18 | #define NET_SERVER_H 19 | 20 | // initialize server and wait for connections 21 | 22 | void NET_SV_Init(void); 23 | 24 | // run server: check for new packets received etc. 25 | 26 | void NET_SV_Run(void); 27 | 28 | // Shut down the server 29 | // Blocks until all clients disconnect, or until a 5 second timeout 30 | 31 | void NET_SV_Shutdown(void); 32 | 33 | // Add a network module to the context used by the server 34 | 35 | void NET_SV_AddModule(net_module_t *module); 36 | 37 | // Register server with master server. 38 | 39 | void NET_SV_RegisterWithMaster(void); 40 | 41 | #endif /* #ifndef NET_SERVER_H */ 42 | 43 | -------------------------------------------------------------------------------- /src/chocdoom/r_local.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Refresh (R_*) module, global header. 17 | // All the rendering/drawing stuff is here. 18 | // 19 | 20 | #ifndef __R_LOCAL__ 21 | #define __R_LOCAL__ 22 | 23 | // Binary Angles, sine/cosine/atan lookups. 24 | #include "tables.h" 25 | 26 | // Screen size related parameters. 27 | #include "doomdef.h" 28 | 29 | // Include the refresh/render data structs. 30 | #include "r_data.h" 31 | 32 | 33 | 34 | // 35 | // Separate header file for each module. 36 | // 37 | #include "r_main.h" 38 | #include "r_bsp.h" 39 | #include "r_segs.h" 40 | #include "r_plane.h" 41 | #include "r_data.h" 42 | #include "r_things.h" 43 | #include "r_draw.h" 44 | 45 | #endif // __R_LOCAL__ 46 | -------------------------------------------------------------------------------- /src/chocdoom/sha1.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 2005-2014 Simon Howard 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // DESCRIPTION: 15 | // SHA-1 digest. 16 | // 17 | 18 | #ifndef __SHA1_H__ 19 | #define __SHA1_H__ 20 | 21 | #include "doomtype.h" 22 | 23 | typedef struct sha1_context_s sha1_context_t; 24 | typedef byte sha1_digest_t[20]; 25 | 26 | struct sha1_context_s { 27 | uint32_t h0,h1,h2,h3,h4; 28 | uint32_t nblocks; 29 | byte buf[64]; 30 | int count; 31 | }; 32 | 33 | void SHA1_Init(sha1_context_t *context); 34 | void SHA1_Update(sha1_context_t *context, byte *buf, size_t len); 35 | void SHA1_Final(sha1_digest_t digest, sha1_context_t *context); 36 | void SHA1_UpdateInt32(sha1_context_t *context, unsigned int val); 37 | void SHA1_UpdateString(sha1_context_t *context, char *str); 38 | 39 | #endif /* #ifndef __SHA1_H__ */ 40 | 41 | -------------------------------------------------------------------------------- /src/chocdoom/m_bbox.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Main loop menu stuff. 17 | // Random number LUT. 18 | // Default Config File. 19 | // PCX Screenshots. 20 | // 21 | 22 | 23 | 24 | #include "m_bbox.h" 25 | 26 | 27 | 28 | 29 | void M_ClearBox (fixed_t *box) 30 | { 31 | box[BOXTOP] = box[BOXRIGHT] = INT_MIN; 32 | box[BOXBOTTOM] = box[BOXLEFT] = INT_MAX; 33 | } 34 | 35 | void 36 | M_AddToBox 37 | ( fixed_t* box, 38 | fixed_t x, 39 | fixed_t y ) 40 | { 41 | if (xbox[BOXRIGHT]) 44 | box[BOXRIGHT] = x; 45 | if (ybox[BOXTOP]) 48 | box[BOXTOP] = y; 49 | } 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /src/chocdoom/memio.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | 16 | #ifndef MEMIO_H 17 | #define MEMIO_H 18 | 19 | typedef struct _MEMFILE MEMFILE; 20 | 21 | typedef enum 22 | { 23 | MEM_SEEK_SET, 24 | MEM_SEEK_CUR, 25 | MEM_SEEK_END, 26 | } mem_rel_t; 27 | 28 | MEMFILE *mem_fopen_read(void *buf, size_t buflen); 29 | size_t mem_fread(void *buf, size_t size, size_t nmemb, MEMFILE *stream); 30 | MEMFILE *mem_fopen_write(void); 31 | size_t mem_fwrite(const void *ptr, size_t size, size_t nmemb, MEMFILE *stream); 32 | void mem_get_buf(MEMFILE *stream, void **buf, size_t *buflen); 33 | void mem_fclose(MEMFILE *stream); 34 | long mem_ftell(MEMFILE *stream); 35 | int mem_fseek(MEMFILE *stream, signed long offset, mem_rel_t whence); 36 | 37 | #endif /* #ifndef MEMIO_H */ 38 | 39 | -------------------------------------------------------------------------------- /src/chocdoom/wi_stuff.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Intermission. 17 | // 18 | 19 | #ifndef __WI_STUFF__ 20 | #define __WI_STUFF__ 21 | 22 | //#include "v_video.h" 23 | 24 | #include "doomdef.h" 25 | 26 | // States for the intermission 27 | 28 | typedef enum 29 | { 30 | NoState = -1, 31 | StatCount, 32 | ShowNextLoc, 33 | } stateenum_t; 34 | 35 | // Called by main loop, animate the intermission. 36 | void WI_Ticker (void); 37 | 38 | // Called by main loop, 39 | // draws the intermission directly into the screen buffer. 40 | void WI_Drawer (void); 41 | 42 | // Setup for an intermission screen. 43 | void WI_Start(wbstartstruct_t* wbstartstruct); 44 | 45 | // Shut down the intermission screen 46 | void WI_End(void); 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/chocdoom/m_config.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Configuration file interface. 17 | // 18 | 19 | 20 | #ifndef __M_CONFIG__ 21 | #define __M_CONFIG__ 22 | 23 | #include "doomtype.h" 24 | 25 | void M_LoadDefaults(void); 26 | void M_SaveDefaults(void); 27 | void M_SaveDefaultsAlternate(char *main, char *extra); 28 | void M_SetConfigDir(char *dir); 29 | void M_BindVariable(char *name, void *variable); 30 | boolean M_SetVariable(char *name, char *value); 31 | int M_GetIntVariable(char *name); 32 | const char *M_GetStrVariable(char *name); 33 | float M_GetFloatVariable(char *name); 34 | void M_SetConfigFilenames(char *main_config, char *extra_config); 35 | char *M_GetSaveGameDir(char *iwadname); 36 | 37 | extern char *configdir; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /src/chocdoom/deh_str.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 2005-2014 Simon Howard 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // 15 | // Dehacked string replacements 16 | // 17 | 18 | #ifndef DEH_STR_H 19 | #define DEH_STR_H 20 | 21 | #include 22 | 23 | #include "doomfeatures.h" 24 | 25 | // Used to do dehacked text substitutions throughout the program 26 | 27 | #ifdef FEATURE_DEHACKED 28 | 29 | char *DEH_String(char *s); 30 | void DEH_printf(char *fmt, ...); 31 | void DEH_fprintf(FILE *fstream, char *fmt, ...); 32 | void DEH_snprintf(char *buffer, size_t len, char *fmt, ...); 33 | void DEH_AddStringReplacement(char *from_text, char *to_text); 34 | 35 | 36 | #else 37 | 38 | #define DEH_String(x) (x) 39 | #define DEH_printf printf 40 | #define DEH_fprintf fprintf 41 | #define DEH_snprintf snprintf 42 | #define DEH_AddStringReplacement(x, y) 43 | 44 | #endif 45 | 46 | #endif /* #ifndef DEH_STR_H */ 47 | 48 | -------------------------------------------------------------------------------- /src/chocdoom/net_io.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 2005-2014 Simon Howard 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // DESCRIPTION: 15 | // Network packet manipulation (net_packet_t) 16 | // 17 | 18 | #ifndef NET_IO_H 19 | #define NET_IO_H 20 | 21 | #include "net_defs.h" 22 | 23 | extern net_addr_t net_broadcast_addr; 24 | 25 | net_context_t *NET_NewContext(void); 26 | void NET_AddModule(net_context_t *context, net_module_t *module); 27 | void NET_SendPacket(net_addr_t *addr, net_packet_t *packet); 28 | void NET_SendBroadcast(net_context_t *context, net_packet_t *packet); 29 | boolean NET_RecvPacket(net_context_t *context, net_addr_t **addr, 30 | net_packet_t **packet); 31 | char *NET_AddrToString(net_addr_t *addr); 32 | void NET_FreeAddress(net_addr_t *addr); 33 | net_addr_t *NET_ResolveAddress(net_context_t *context, char *address); 34 | 35 | #endif /* #ifndef NET_IO_H */ 36 | 37 | -------------------------------------------------------------------------------- /src/chocdoom/w_merge.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 2005-2014 Simon Howard 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // DESCRIPTION: 15 | // Handles merging of PWADs, similar to deutex's -merge option 16 | // 17 | // Ideally this should work exactly the same as in deutex, but trying to 18 | // read the deutex source code made my brain hurt. 19 | // 20 | 21 | #ifndef W_MERGE_H 22 | #define W_MERGE_H 23 | 24 | #define W_NWT_MERGE_SPRITES 0x1 25 | #define W_NWT_MERGE_FLATS 0x2 26 | 27 | // Add a new WAD and merge it into the main directory 28 | 29 | void W_MergeFile(char *filename); 30 | 31 | // NWT-style merging 32 | 33 | void W_NWTMergeFile(char *filename, int flags); 34 | 35 | // Acts the same as NWT's "-merge" option. 36 | 37 | void W_NWTDashMerge(char *filename); 38 | 39 | // Debug function that prints the WAD directory. 40 | 41 | void W_PrintDirectory(void); 42 | 43 | #endif /* #ifndef W_MERGE_H */ 44 | 45 | -------------------------------------------------------------------------------- /src/chocdoom/m_fixed.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Fixed point implementation. 17 | // 18 | 19 | 20 | 21 | #include "stdlib.h" 22 | 23 | #include "doomtype.h" 24 | #include "i_system.h" 25 | 26 | #include "m_fixed.h" 27 | 28 | 29 | 30 | 31 | // Fixme. __USE_C_FIXED__ or something. 32 | 33 | fixed_t 34 | FixedMul 35 | ( fixed_t a, 36 | fixed_t b ) 37 | { 38 | return ((int64_t) a * (int64_t) b) >> FRACBITS; 39 | } 40 | 41 | 42 | 43 | // 44 | // FixedDiv, C version. 45 | // 46 | 47 | fixed_t FixedDiv(fixed_t a, fixed_t b) 48 | { 49 | if ((abs(a) >> 14) >= abs(b)) 50 | { 51 | return (a^b) < 0 ? INT_MIN : INT_MAX; 52 | } 53 | else 54 | { 55 | int64_t result; 56 | 57 | result = ((int64_t) a << 16) / b; 58 | 59 | return (fixed_t) result; 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /src/chocdoom/r_sky.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Sky rendering. The DOOM sky is a texture map like any 17 | // wall, wrapping around. A 1024 columns equal 360 degrees. 18 | // The default sky map is 256 columns and repeats 4 times 19 | // on a 320 screen? 20 | // 21 | // 22 | 23 | 24 | 25 | // Needed for FRACUNIT. 26 | #include "m_fixed.h" 27 | 28 | // Needed for Flat retrieval. 29 | #include "r_data.h" 30 | 31 | 32 | #include "r_sky.h" 33 | 34 | // 35 | // sky mapping 36 | // 37 | int skyflatnum; 38 | int skytexture; 39 | int skytexturemid; 40 | 41 | 42 | 43 | // 44 | // R_InitSkyMap 45 | // Called whenever the view size changes. 46 | // 47 | void R_InitSkyMap (void) 48 | { 49 | // skyflatnum = R_FlatNumForName ( SKYFLATNAME ); 50 | skytexturemid = 100*FRACUNIT; 51 | } 52 | 53 | -------------------------------------------------------------------------------- /src/chocdoom/m_argv.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Nil. 17 | // 18 | 19 | 20 | #ifndef __M_ARGV__ 21 | #define __M_ARGV__ 22 | 23 | #include "doomtype.h" 24 | 25 | // 26 | // MISC 27 | // 28 | extern int myargc; 29 | extern char** myargv; 30 | 31 | // Returns the position of the given parameter 32 | // in the arg list (0 if not found). 33 | int M_CheckParm (char* check); 34 | 35 | // Same as M_CheckParm, but checks that num_args arguments are available 36 | // following the specified argument. 37 | int M_CheckParmWithArgs(char *check, int num_args); 38 | 39 | void M_FindResponseFile(void); 40 | 41 | // Parameter has been specified? 42 | 43 | boolean M_ParmExists(char *check); 44 | 45 | // Get name of executable used to run this program: 46 | 47 | char *M_GetExecutableName(void); 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/chocdoom/f_wipe.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Mission start screen wipe/melt, special effects. 17 | // 18 | 19 | 20 | #ifndef __F_WIPE_H__ 21 | #define __F_WIPE_H__ 22 | 23 | // 24 | // SCREEN WIPE PACKAGE 25 | // 26 | 27 | enum 28 | { 29 | // simple gradual pixel change for 8-bit only 30 | wipe_ColorXForm, 31 | 32 | // weird screen melt 33 | wipe_Melt, 34 | 35 | wipe_NUMWIPES 36 | }; 37 | 38 | int 39 | wipe_StartScreen 40 | ( int x, 41 | int y, 42 | int width, 43 | int height ); 44 | 45 | 46 | int 47 | wipe_EndScreen 48 | ( int x, 49 | int y, 50 | int width, 51 | int height ); 52 | 53 | 54 | int 55 | wipe_ScreenWipe 56 | ( int wipeno, 57 | int x, 58 | int y, 59 | int width, 60 | int height, 61 | int ticks ); 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /lib/fatfs/fatfs_usbdisk.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------- 2 | // File : stm32_ub_usbdisk.h 3 | //-------------------------------------------------------------- 4 | 5 | //-------------------------------------------------------------- 6 | #ifndef __STM32F4_UB_USBDISK_H 7 | #define __STM32F4_UB_USBDISK_H 8 | 9 | 10 | //-------------------------------------------------------------- 11 | // Includes 12 | //-------------------------------------------------------------- 13 | #include "stm32f4xx.h" 14 | #include "diskio.h" 15 | #include "usb_core.h" 16 | #include "usbh_core.h" 17 | #include "usbh_msc_scsi.h" 18 | #include "usbh_msc_bot.h" 19 | #include "usb_msc_host.h" 20 | 21 | 22 | 23 | 24 | #define USB_PRESENT ((uint8_t)0x01) 25 | #define USB_NOT_PRESENT ((uint8_t)0x00) 26 | 27 | 28 | //-------------------------------------------------------------- 29 | // Globale Funktionen 30 | //-------------------------------------------------------------- 31 | void USBDisk_Init(void); 32 | uint8_t USBDrive_CheckMedia(void); 33 | int USB_disk_initialize(void); 34 | int USB_disk_status(void); 35 | int USB_disk_read(BYTE *buff, DWORD sector, BYTE count); 36 | int USB_disk_write(const BYTE *buff, DWORD sector, BYTE count); 37 | int USB_disk_ioctl(BYTE cmd, void *buff); 38 | 39 | 40 | //-------------------------------------------------------------- 41 | #endif // __STM32F4_UB_USBDISK_H 42 | -------------------------------------------------------------------------------- /src/chocdoom/am_map.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // AutoMap module. 17 | // 18 | 19 | #ifndef __AMMAP_H__ 20 | #define __AMMAP_H__ 21 | 22 | #include "d_event.h" 23 | #include "m_cheat.h" 24 | 25 | // Used by ST StatusBar stuff. 26 | #define AM_MSGHEADER (('a'<<24)+('m'<<16)) 27 | #define AM_MSGENTERED (AM_MSGHEADER | ('e'<<8)) 28 | #define AM_MSGEXITED (AM_MSGHEADER | ('x'<<8)) 29 | 30 | 31 | // Called by main loop. 32 | boolean AM_Responder (event_t* ev); 33 | 34 | // Called by main loop. 35 | void AM_Ticker (void); 36 | 37 | // Called by main loop, 38 | // called instead of view drawer if automap active. 39 | void AM_Drawer (void); 40 | 41 | // Called to force the automap to quit 42 | // if the level is completed while it is up. 43 | void AM_Stop (void); 44 | 45 | 46 | extern cheatseq_t cheat_amap; 47 | 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/chocdoom/r_data.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Refresh module, data I/O, caching, retrieval of graphics 17 | // by name. 18 | // 19 | 20 | 21 | #ifndef __R_DATA__ 22 | #define __R_DATA__ 23 | 24 | #include "r_defs.h" 25 | #include "r_state.h" 26 | 27 | 28 | // Retrieve column data for span blitting. 29 | byte* 30 | R_GetColumn 31 | ( int tex, 32 | int col ); 33 | 34 | 35 | // I/O, setting up the stuff. 36 | void R_InitData (void); 37 | void R_PrecacheLevel (void); 38 | 39 | 40 | // Retrieval. 41 | // Floor/ceiling opaque texture tiles, 42 | // lookup by name. For animation? 43 | int R_FlatNumForName (char* name); 44 | 45 | 46 | // Called by P_Ticker for switches and animations, 47 | // returns the texture number for the texture name. 48 | int R_TextureNumForName (char *name); 49 | int R_CheckTextureNumForName (char *name); 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /src/chocdoom/i_cdmus.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 1993-2008 Raven Software 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | 16 | // i_cdmus.h 17 | 18 | #ifndef __ICDMUS__ 19 | #define __ICDMUS__ 20 | 21 | #define CDERR_NOTINSTALLED 10 // MSCDEX not installed 22 | #define CDERR_NOAUDIOSUPPORT 11 // CD-ROM Doesn't support audio 23 | #define CDERR_NOAUDIOTRACKS 12 // Current CD has no audio tracks 24 | #define CDERR_BADDRIVE 20 // Bad drive number 25 | #define CDERR_BADTRACK 21 // Bad track number 26 | #define CDERR_IOCTLBUFFMEM 22 // Not enough low memory for IOCTL 27 | #define CDERR_DEVREQBASE 100 // DevReq errors 28 | 29 | extern int cd_Error; 30 | 31 | int I_CDMusInit(void); 32 | void I_CDMusPrintStartup(void); 33 | int I_CDMusPlay(int track); 34 | int I_CDMusStop(void); 35 | int I_CDMusResume(void); 36 | int I_CDMusSetVolume(int volume); 37 | int I_CDMusFirstTrack(void); 38 | int I_CDMusLastTrack(void); 39 | int I_CDMusTrackLength(int track); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/chocdoom/m_cheat.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Cheat code checking. 17 | // 18 | 19 | 20 | #ifndef __M_CHEAT__ 21 | #define __M_CHEAT__ 22 | 23 | // 24 | // CHEAT SEQUENCE PACKAGE 25 | // 26 | 27 | // declaring a cheat 28 | 29 | #define CHEAT(value, parameters) \ 30 | { value, sizeof(value) - 1, parameters, 0, 0, "" } 31 | 32 | #define MAX_CHEAT_LEN 25 33 | #define MAX_CHEAT_PARAMS 5 34 | 35 | typedef struct 36 | { 37 | // settings for this cheat 38 | 39 | char sequence[MAX_CHEAT_LEN]; 40 | size_t sequence_len; 41 | int parameter_chars; 42 | 43 | // state used during the game 44 | 45 | size_t chars_read; 46 | int param_chars_read; 47 | char parameter_buf[MAX_CHEAT_PARAMS]; 48 | } cheatseq_t; 49 | 50 | int 51 | cht_CheckCheat 52 | ( cheatseq_t* cht, 53 | char key ); 54 | 55 | 56 | void 57 | cht_GetParam 58 | ( cheatseq_t* cht, 59 | char* buffer ); 60 | 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /src/chocdoom/hu_stuff.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: Head up display 16 | // 17 | 18 | #ifndef __HU_STUFF_H__ 19 | #define __HU_STUFF_H__ 20 | 21 | #include "d_event.h" 22 | 23 | 24 | // 25 | // Globally visible constants. 26 | // 27 | #define HU_FONTSTART '!' // the first font characters 28 | #define HU_FONTEND '_' // the last font characters 29 | 30 | // Calculate # of glyphs in font. 31 | #define HU_FONTSIZE (HU_FONTEND - HU_FONTSTART + 1) 32 | 33 | #define HU_BROADCAST 5 34 | 35 | #define HU_MSGX 0 36 | #define HU_MSGY 0 37 | #define HU_MSGWIDTH 64 // in characters 38 | #define HU_MSGHEIGHT 1 // in lines 39 | 40 | #define HU_MSGTIMEOUT (4*TICRATE) 41 | 42 | // 43 | // HEADS UP TEXT 44 | // 45 | 46 | void HU_Init(void); 47 | void HU_Start(void); 48 | 49 | boolean HU_Responder(event_t* ev); 50 | 51 | void HU_Ticker(void); 52 | void HU_Drawer(void); 53 | char HU_dequeueChatChar(void); 54 | void HU_Erase(void); 55 | 56 | extern char *chat_macros[10]; 57 | 58 | #endif 59 | 60 | -------------------------------------------------------------------------------- /src/chocdoom/r_bsp.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Refresh module, BSP traversal and handling. 17 | // 18 | 19 | 20 | #ifndef __R_BSP__ 21 | #define __R_BSP__ 22 | 23 | 24 | 25 | extern seg_t* curline; 26 | extern side_t* sidedef; 27 | extern line_t* linedef; 28 | extern sector_t* frontsector; 29 | extern sector_t* backsector; 30 | 31 | extern int rw_x; 32 | extern int rw_stopx; 33 | 34 | extern boolean segtextured; 35 | 36 | // false if the back side is the same plane 37 | extern boolean markfloor; 38 | extern boolean markceiling; 39 | 40 | extern boolean skymap; 41 | 42 | extern drawseg_t drawsegs[MAXDRAWSEGS]; 43 | extern drawseg_t* ds_p; 44 | 45 | extern lighttable_t** hscalelight; 46 | extern lighttable_t** vscalelight; 47 | extern lighttable_t** dscalelight; 48 | 49 | 50 | typedef void (*drawfunc_t) (int start, int stop); 51 | 52 | 53 | // BSP? 54 | void R_ClearClipSegs (void); 55 | void R_ClearDrawSegs (void); 56 | 57 | 58 | void R_RenderBSPNode (int bspnum); 59 | 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /src/chocdoom/i_swap.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Endianess handling, swapping 16bit and 32bit. 17 | // 18 | 19 | 20 | #ifndef __I_SWAP__ 21 | #define __I_SWAP__ 22 | 23 | #ifdef ORIGCODE 24 | #include "SDL_endian.h" 25 | 26 | // Endianess handling. 27 | // WAD files are stored little endian. 28 | 29 | // Just use SDL's endianness swapping functions. 30 | 31 | // These are deliberately cast to signed values; this is the behaviour 32 | // of the macros in the original source and some code relies on it. 33 | 34 | #define SHORT(x) ((signed short) SDL_SwapLE16(x)) 35 | #define LONG(x) ((signed int) SDL_SwapLE32(x)) 36 | 37 | // Defines for checking the endianness of the system. 38 | 39 | #if SDL_BYTEORDER == SYS_LIL_ENDIAN 40 | #define SYS_LITTLE_ENDIAN 41 | #elif SDL_BYTEORDER == SYS_BIG_ENDIAN 42 | #define SYS_BIG_ENDIAN 43 | #endif 44 | 45 | #else 46 | 47 | #define SHORT(x) ((signed short) (x)) 48 | #define LONG(x) ((signed int) (x)) 49 | 50 | #define SYS_LITTLE_ENDIAN 51 | 52 | #endif 53 | #endif 54 | 55 | -------------------------------------------------------------------------------- /src/chocdoom/v_patch.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Refresh/rendering module, shared data struct definitions. 17 | // 18 | 19 | 20 | #ifndef V_PATCH_H 21 | #define V_PATCH_H 22 | 23 | // Patches. 24 | // A patch holds one or more columns. 25 | // Patches are used for sprites and all masked pictures, 26 | // and we compose textures from the TEXTURE1/2 lists 27 | // of patches. 28 | 29 | typedef struct 30 | { 31 | short width; // bounding box size 32 | short height; 33 | short leftoffset; // pixels to the left of origin 34 | short topoffset; // pixels below the origin 35 | int columnofs[8]; // only [width] used 36 | // the [0] is &columnofs[width] 37 | } PACKEDATTR patch_t; 38 | 39 | // posts are runs of non masked source pixels 40 | typedef struct 41 | { 42 | byte topdelta; // -1 is the last post in a column 43 | byte length; // length data bytes follows 44 | } PACKEDATTR post_t; 45 | 46 | // column_t is a list of 0 or more post_t, (byte)-1 terminated 47 | typedef post_t column_t; 48 | 49 | #endif 50 | 51 | -------------------------------------------------------------------------------- /src/chocdoom/deh_main.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 2005-2014 Simon Howard 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // 15 | // Dehacked entrypoint and common code 16 | // 17 | 18 | #ifndef DEH_MAIN_H 19 | #define DEH_MAIN_H 20 | 21 | #include "doomtype.h" 22 | #include "doomfeatures.h" 23 | #include "deh_str.h" 24 | #include "sha1.h" 25 | 26 | // These are the limits that dehacked uses (from dheinit.h in the dehacked 27 | // source). If these limits are exceeded, it does not generate an error, but 28 | // a warning is displayed. 29 | 30 | #define DEH_VANILLA_NUMSTATES 966 31 | #define DEH_VANILLA_NUMSFX 107 32 | 33 | void DEH_ParseCommandLine(void); 34 | int DEH_LoadFile(char *filename); 35 | int DEH_LoadLump(int lumpnum, boolean allow_long, boolean allow_error); 36 | int DEH_LoadLumpByName(char *name, boolean allow_long, boolean allow_error); 37 | 38 | boolean DEH_ParseAssignment(char *line, char **variable_name, char **value); 39 | 40 | void DEH_Checksum(sha1_digest_t digest); 41 | 42 | extern boolean deh_allow_extended_strings; 43 | extern boolean deh_allow_long_strings; 44 | extern boolean deh_allow_long_cheats; 45 | extern boolean deh_apply_cheats; 46 | 47 | #endif /* #ifndef DEH_MAIN_H */ 48 | 49 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | STM32Doom 2 | 3 | This is a port of Chocolate Doom for the STM32F429IDISCOVERY evaluation board. 4 | The board features the STM32F429 ARM Cortex-M4 microcontroller with 8 MB 5 | external SD-RAM and a 320x240 pixel LCD panel with touchscreen controller. 6 | 7 | You need to attach a USB memory stick (formatted as FAT32) to USB USER (micro 8 | USB connector) using a USB-OTG cable. The USB stick must contain a /doom 9 | directory with the file doom1.wad inside it. This file is the WAD file shipped 10 | with the original Doom shareware released by id Software in 1993. doom.wad from 11 | the retail version is too big and therefore not supported. 12 | 13 | The port makes use of the STM32 standard peripherals library, STM32 USB library, 14 | ChaN's FatFs library, ub's libraries for STM32F429 and of course Chocolate Doom. 15 | 16 | 17 | Compilation 18 | 19 | Using the GNU Tools for ARM Embedded Processors and 'make' just run: 20 | # make 21 | 22 | 23 | Controls 24 | 25 | The screen is divided into several touch areas with the following functions: 26 | 27 | Bottom left: strafe left 28 | Bottom right: strafe right 29 | Bottom center: back/menu down 30 | Upper left: turn left 31 | Upper right: turn right 32 | Upper center: forward/menu up 33 | 34 | 35 | Video 36 | 37 | http://www.youtube.com/watch?v=bRNcfsDIc2A 38 | 39 | 40 | Links 41 | 42 | STM32F429 evaluation board 43 | http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/PF259090 44 | 45 | Chocolate Doom 46 | https://github.com/chocolate-doom/chocolate-doom 47 | 48 | FatFs 49 | http://elm-chan.org/fsw/ff/00index_e.html 50 | 51 | ub's STM32F429 Libraries 52 | http://mikrocontroller.bplaced.net 53 | 54 | GCC ARM 55 | http://launchpad.net/gcc-arm-embedded -------------------------------------------------------------------------------- /src/chocdoom/net_query.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 2005-2014 Simon Howard 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // DESCRIPTION: 15 | // Querying servers to find their current status. 16 | // 17 | 18 | #ifndef NET_QUERY_H 19 | #define NET_QUERY_H 20 | 21 | #include "net_defs.h" 22 | 23 | typedef void (*net_query_callback_t)(net_addr_t *addr, 24 | net_querydata_t *querydata, 25 | unsigned int ping_time, 26 | void *user_data); 27 | 28 | extern int NET_StartLANQuery(void); 29 | extern int NET_StartMasterQuery(void); 30 | 31 | extern void NET_LANQuery(void); 32 | extern void NET_MasterQuery(void); 33 | extern void NET_QueryAddress(char *addr); 34 | extern net_addr_t *NET_FindLANServer(void); 35 | 36 | extern int NET_Query_Poll(net_query_callback_t callback, void *user_data); 37 | 38 | extern net_addr_t *NET_Query_ResolveMaster(net_context_t *context); 39 | extern void NET_Query_AddToMaster(net_addr_t *master_addr); 40 | extern boolean NET_Query_CheckAddedToMaster(boolean *result); 41 | extern void NET_Query_MasterResponse(net_packet_t *packet); 42 | 43 | #endif /* #ifndef NET_QUERY_H */ 44 | 45 | -------------------------------------------------------------------------------- /src/chocdoom/d_event.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // 16 | // DESCRIPTION: Event handling. 17 | // 18 | // Events are asynchronous inputs generally generated by the game user. 19 | // Events can be discarded if no responder claims them 20 | // 21 | 22 | #include 23 | #include "d_event.h" 24 | 25 | #define MAXEVENTS 64 26 | 27 | static event_t events[MAXEVENTS]; 28 | static int eventhead; 29 | static int eventtail; 30 | 31 | // 32 | // D_PostEvent 33 | // Called by the I/O functions when input is detected 34 | // 35 | void D_PostEvent (event_t* ev) 36 | { 37 | events[eventhead] = *ev; 38 | eventhead = (eventhead + 1) % MAXEVENTS; 39 | } 40 | 41 | // Read an event from the queue. 42 | 43 | event_t *D_PopEvent(void) 44 | { 45 | event_t *result; 46 | 47 | // No more events waiting. 48 | 49 | if (eventtail == eventhead) 50 | { 51 | return NULL; 52 | } 53 | 54 | result = &events[eventtail]; 55 | 56 | // Advance to the next event in the queue. 57 | 58 | eventtail = (eventtail + 1) % MAXEVENTS; 59 | 60 | return result; 61 | } 62 | 63 | 64 | -------------------------------------------------------------------------------- /src/chocdoom/m_menu.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Menu widget stuff, episode selection and such. 17 | // 18 | 19 | 20 | #ifndef __M_MENU__ 21 | #define __M_MENU__ 22 | 23 | 24 | 25 | #include "d_event.h" 26 | 27 | // 28 | // MENUS 29 | // 30 | // Called by main loop, 31 | // saves config file and calls I_Quit when user exits. 32 | // Even when the menu is not displayed, 33 | // this can resize the view and change game parameters. 34 | // Does all the real work of the menu interaction. 35 | boolean M_Responder (event_t *ev); 36 | 37 | 38 | // Called by main loop, 39 | // only used for menu (skull cursor) animation. 40 | void M_Ticker (void); 41 | 42 | // Called by main loop, 43 | // draws the menus directly into the screen buffer. 44 | void M_Drawer (void); 45 | 46 | // Called by D_DoomMain, 47 | // loads the config file. 48 | void M_Init (void); 49 | 50 | // Called by intro code to force menu up upon a keypress, 51 | // does nothing if menu is already up. 52 | void M_StartControlPanel (void); 53 | 54 | 55 | 56 | extern int detailLevel; 57 | extern int screenblocks; 58 | 59 | 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /src/chocdoom/r_plane.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Refresh, visplane stuff (floor, ceilings). 17 | // 18 | 19 | 20 | #ifndef __R_PLANE__ 21 | #define __R_PLANE__ 22 | 23 | 24 | #include "r_data.h" 25 | 26 | 27 | 28 | // Visplane related. 29 | extern short* lastopening; 30 | 31 | 32 | typedef void (*planefunction_t) (int top, int bottom); 33 | 34 | extern planefunction_t floorfunc; 35 | extern planefunction_t ceilingfunc_t; 36 | 37 | extern short floorclip[SCREENWIDTH]; 38 | extern short ceilingclip[SCREENWIDTH]; 39 | 40 | extern fixed_t yslope[SCREENHEIGHT]; 41 | extern fixed_t distscale[SCREENWIDTH]; 42 | 43 | void R_InitPlanes (void); 44 | void R_ClearPlanes (void); 45 | 46 | void 47 | R_MapPlane 48 | ( int y, 49 | int x1, 50 | int x2 ); 51 | 52 | void 53 | R_MakeSpans 54 | ( int x, 55 | int t1, 56 | int b1, 57 | int t2, 58 | int b2 ); 59 | 60 | void R_DrawPlanes (void); 61 | 62 | visplane_t* 63 | R_FindPlane 64 | ( fixed_t height, 65 | int picnum, 66 | int lightlevel ); 67 | 68 | visplane_t* 69 | R_CheckPlane 70 | ( visplane_t* pl, 71 | int start, 72 | int stop ); 73 | 74 | 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /src/chocdoom/d_think.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // MapObj data. Map Objects or mobjs are actors, entities, 17 | // thinker, take-your-pick... anything that moves, acts, or 18 | // suffers state changes of more or less violent nature. 19 | // 20 | 21 | 22 | #ifndef __D_THINK__ 23 | #define __D_THINK__ 24 | 25 | 26 | 27 | 28 | 29 | // 30 | // Experimental stuff. 31 | // To compile this as "ANSI C with classes" 32 | // we will need to handle the various 33 | // action functions cleanly. 34 | // 35 | typedef void (*actionf_v)(); 36 | typedef void (*actionf_p1)( void* ); 37 | typedef void (*actionf_p2)( void*, void* ); 38 | 39 | typedef union 40 | { 41 | actionf_v acv; 42 | actionf_p1 acp1; 43 | actionf_p2 acp2; 44 | 45 | } actionf_t; 46 | 47 | 48 | 49 | 50 | 51 | // Historically, "think_t" is yet another 52 | // function pointer to a routine to handle 53 | // an actor. 54 | typedef actionf_t think_t; 55 | 56 | 57 | // Doubly linked list of actors. 58 | typedef struct thinker_s 59 | { 60 | struct thinker_s* prev; 61 | struct thinker_s* next; 62 | think_t function; 63 | 64 | } thinker_t; 65 | 66 | 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /src/chocdoom/d_ticcmd.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 1993-2008 Raven Software 4 | // Copyright(C) 2005-2014 Simon Howard 5 | // 6 | // This program is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU General Public License 8 | // as published by the Free Software Foundation; either version 2 9 | // of the License, or (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // DESCRIPTION: 17 | // System specific interface stuff. 18 | // 19 | 20 | 21 | #ifndef __D_TICCMD__ 22 | #define __D_TICCMD__ 23 | 24 | #include "doomtype.h" 25 | 26 | 27 | // The data sampled per tick (single player) 28 | // and transmitted to other peers (multiplayer). 29 | // Mainly movements/button commands per game tick, 30 | // plus a checksum for internal state consistency. 31 | 32 | typedef struct 33 | { 34 | signed char forwardmove; // *2048 for move 35 | signed char sidemove; // *2048 for move 36 | short angleturn; // <<16 for angle delta 37 | byte chatchar; 38 | byte buttons; 39 | // villsa [STRIFE] according to the asm, 40 | // consistancy is a short, not a byte 41 | byte consistancy; // checks for net game 42 | 43 | // villsa - Strife specific: 44 | 45 | byte buttons2; 46 | int inventory; 47 | 48 | // Heretic/Hexen specific: 49 | 50 | byte lookfly; // look/fly up/down/centering 51 | byte arti; // artitype_t to use 52 | } ticcmd_t; 53 | 54 | 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/chocdoom/i_scale.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Pixel-doubling scale up functions. 17 | // 18 | 19 | 20 | #ifndef __I_SCALE__ 21 | #define __I_SCALE__ 22 | 23 | #include "doomtype.h" 24 | 25 | void I_InitScale(byte *_src_buffer, byte *_dest_buffer, int _dest_pitch); 26 | void I_ResetScaleTables(byte *palette); 27 | 28 | // Scaled modes (direct multiples of 320x200) 29 | 30 | extern screen_mode_t mode_scale_1x; 31 | extern screen_mode_t mode_scale_2x; 32 | extern screen_mode_t mode_scale_3x; 33 | extern screen_mode_t mode_scale_4x; 34 | extern screen_mode_t mode_scale_5x; 35 | 36 | // Vertically stretched modes (320x200 -> multiples of 320x240) 37 | 38 | extern screen_mode_t mode_stretch_1x; 39 | extern screen_mode_t mode_stretch_2x; 40 | extern screen_mode_t mode_stretch_3x; 41 | extern screen_mode_t mode_stretch_4x; 42 | extern screen_mode_t mode_stretch_5x; 43 | 44 | // Horizontally squashed modes (320x200 -> multiples of 256x200) 45 | 46 | extern screen_mode_t mode_squash_1x; 47 | extern screen_mode_t mode_squash_2x; 48 | extern screen_mode_t mode_squash_3x; 49 | extern screen_mode_t mode_squash_4x; 50 | extern screen_mode_t mode_squash_5x; 51 | 52 | #endif /* #ifndef __I_SCALE__ */ 53 | 54 | -------------------------------------------------------------------------------- /src/chocdoom/p_saveg.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Savegame I/O, archiving, persistence. 17 | // 18 | 19 | 20 | #ifndef __P_SAVEG__ 21 | #define __P_SAVEG__ 22 | 23 | #include "ff.h" 24 | 25 | // maximum size of a savegame description 26 | 27 | #define SAVESTRINGSIZE 24 28 | 29 | // temporary filename to use while saving. 30 | 31 | char *P_TempSaveGameFile(void); 32 | 33 | // filename to use for a savegame slot 34 | 35 | char *P_SaveGameFile(int slot); 36 | 37 | // Savegame file header read/write functions 38 | 39 | boolean P_ReadSaveGameHeader(void); 40 | void P_WriteSaveGameHeader(char *description); 41 | 42 | // Savegame end-of-file read/write functions 43 | 44 | boolean P_ReadSaveGameEOF(void); 45 | void P_WriteSaveGameEOF(void); 46 | 47 | // Persistent storage/archiving. 48 | // These are the load / save game routines. 49 | void P_ArchivePlayers (void); 50 | void P_UnArchivePlayers (void); 51 | void P_ArchiveWorld (void); 52 | void P_UnArchiveWorld (void); 53 | void P_ArchiveThinkers (void); 54 | void P_UnArchiveThinkers (void); 55 | void P_ArchiveSpecials (void); 56 | void P_UnArchiveSpecials (void); 57 | 58 | extern FIL save_stream; 59 | extern boolean savegame_error; 60 | 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /src/chocdoom/r_things.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Rendering of moving objects, sprites. 17 | // 18 | 19 | 20 | #ifndef __R_THINGS__ 21 | #define __R_THINGS__ 22 | 23 | 24 | 25 | #define MAXVISSPRITES 128 26 | 27 | extern vissprite_t vissprites[MAXVISSPRITES]; 28 | extern vissprite_t* vissprite_p; 29 | extern vissprite_t vsprsortedhead; 30 | 31 | // Constant arrays used for psprite clipping 32 | // and initializing clipping. 33 | extern short negonearray[SCREENWIDTH]; 34 | extern short screenheightarray[SCREENWIDTH]; 35 | 36 | // vars for R_DrawMaskedColumn 37 | extern short* mfloorclip; 38 | extern short* mceilingclip; 39 | extern fixed_t spryscale; 40 | extern fixed_t sprtopscreen; 41 | 42 | extern fixed_t pspritescale; 43 | extern fixed_t pspriteiscale; 44 | 45 | 46 | void R_DrawMaskedColumn (column_t* column); 47 | 48 | 49 | void R_SortVisSprites (void); 50 | 51 | void R_AddSprites (sector_t* sec); 52 | void R_AddPSprites (void); 53 | void R_DrawSprites (void); 54 | void R_InitSprites (char** namelist); 55 | void R_ClearSprites (void); 56 | void R_DrawMasked (void); 57 | 58 | void 59 | R_ClipVisSprite 60 | ( vissprite_t* vis, 61 | int xl, 62 | int xh ); 63 | 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /src/chocdoom/net_client.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 2005-2014 Simon Howard 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // Network client code 15 | // 16 | 17 | #ifndef NET_CLIENT_H 18 | #define NET_CLIENT_H 19 | 20 | #include "doomtype.h" 21 | #include "d_ticcmd.h" 22 | #include "sha1.h" 23 | #include "net_defs.h" 24 | 25 | boolean NET_CL_Connect(net_addr_t *addr, net_connect_data_t *data); 26 | void NET_CL_Disconnect(void); 27 | void NET_CL_Run(void); 28 | void NET_CL_Init(void); 29 | void NET_CL_LaunchGame(void); 30 | void NET_CL_StartGame(net_gamesettings_t *settings); 31 | void NET_CL_SendTiccmd(ticcmd_t *ticcmd, int maketic); 32 | boolean NET_CL_GetSettings(net_gamesettings_t *_settings); 33 | void NET_Init(void); 34 | 35 | void NET_BindVariables(void); 36 | 37 | extern boolean net_client_connected; 38 | extern boolean net_client_received_wait_data; 39 | extern net_waitdata_t net_client_wait_data; 40 | extern boolean net_waiting_for_launch; 41 | extern char *net_player_name; 42 | 43 | extern sha1_digest_t net_server_wad_sha1sum; 44 | extern sha1_digest_t net_server_deh_sha1sum; 45 | extern unsigned int net_server_is_freedoom; 46 | extern sha1_digest_t net_local_wad_sha1sum; 47 | extern sha1_digest_t net_local_deh_sha1sum; 48 | extern unsigned int net_local_is_freedoom; 49 | 50 | extern boolean drone; 51 | 52 | #endif /* #ifndef NET_CLIENT_H */ 53 | -------------------------------------------------------------------------------- /src/chocdoom/d_iwad.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 2005-2014 Simon Howard 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // DESCRIPTION: 15 | // Find IWAD and initialize according to IWAD type. 16 | // 17 | 18 | 19 | #ifndef __D_IWAD__ 20 | #define __D_IWAD__ 21 | 22 | #include "d_mode.h" 23 | 24 | #define IWAD_MASK_DOOM ((1 << doom) \ 25 | | (1 << doom2) \ 26 | | (1 << pack_tnt) \ 27 | | (1 << pack_plut) \ 28 | | (1 << pack_chex) \ 29 | | (1 << pack_hacx)) 30 | #define IWAD_MASK_HERETIC (1 << heretic) 31 | #define IWAD_MASK_HEXEN (1 << hexen) 32 | #define IWAD_MASK_STRIFE (1 << strife) 33 | 34 | typedef struct 35 | { 36 | char *name; 37 | GameMission_t mission; 38 | GameMode_t mode; 39 | char *description; 40 | } iwad_t; 41 | 42 | char *D_FindWADByName(char *filename); 43 | char *D_TryFindWADByName(char *filename); 44 | char *D_FindIWAD(int mask, GameMission_t *mission); 45 | const iwad_t **D_FindAllIWADs(int mask); 46 | char *D_SaveGameIWADName(GameMission_t gamemission); 47 | char *D_SuggestIWADName(GameMission_t mission, GameMode_t mode); 48 | char *D_SuggestGameName(GameMission_t mission, GameMode_t mode); 49 | void D_CheckCorrectIWAD(GameMission_t mission); 50 | 51 | #endif 52 | 53 | -------------------------------------------------------------------------------- /src/chocdoom/p_pspr.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Sprite animation. 17 | // 18 | 19 | 20 | #ifndef __P_PSPR__ 21 | #define __P_PSPR__ 22 | 23 | // Basic data types. 24 | // Needs fixed point, and BAM angles. 25 | #include "m_fixed.h" 26 | #include "tables.h" 27 | 28 | 29 | // 30 | // Needs to include the precompiled 31 | // sprite animation tables. 32 | // Header generated by multigen utility. 33 | // This includes all the data for thing animation, 34 | // i.e. the Thing Atrributes table 35 | // and the Frame Sequence table. 36 | #include "info.h" 37 | 38 | 39 | 40 | // 41 | // Frame flags: 42 | // handles maximum brightness (torches, muzzle flare, light sources) 43 | // 44 | #define FF_FULLBRIGHT 0x8000 // flag in thing->frame 45 | #define FF_FRAMEMASK 0x7fff 46 | 47 | 48 | 49 | // 50 | // Overlay psprites are scaled shapes 51 | // drawn directly on the view screen, 52 | // coordinates are given for a 320*200 view screen. 53 | // 54 | typedef enum 55 | { 56 | ps_weapon, 57 | ps_flash, 58 | NUMPSPRITES 59 | 60 | } psprnum_t; 61 | 62 | typedef struct 63 | { 64 | state_t* state; // a NULL state means not active 65 | int tics; 66 | fixed_t sx; 67 | fixed_t sy; 68 | 69 | } pspdef_t; 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /src/chocdoom/doom.h: -------------------------------------------------------------------------------- 1 | /* 2 | * doom.h 3 | * 4 | * Created on: 18.02.2015 5 | * Author: Florian 6 | */ 7 | 8 | 9 | #ifndef SRC_CHOCDOOM_DOOM_H_ 10 | #define SRC_CHOCDOOM_DOOM_H_ 11 | 12 | /*---------------------------------------------------------------------* 13 | * additional includes * 14 | *---------------------------------------------------------------------*/ 15 | 16 | /*---------------------------------------------------------------------* 17 | * global definitions * 18 | *---------------------------------------------------------------------*/ 19 | 20 | /*---------------------------------------------------------------------* 21 | * type declarations * 22 | *---------------------------------------------------------------------*/ 23 | 24 | /*---------------------------------------------------------------------* 25 | * function prototypes * 26 | *---------------------------------------------------------------------*/ 27 | 28 | void D_DoomMain (void); 29 | 30 | /*---------------------------------------------------------------------* 31 | * global data * 32 | *---------------------------------------------------------------------*/ 33 | 34 | /*---------------------------------------------------------------------* 35 | * inline functions and function-like macros * 36 | *---------------------------------------------------------------------*/ 37 | 38 | /*---------------------------------------------------------------------* 39 | * eof * 40 | *---------------------------------------------------------------------*/ 41 | 42 | #endif /* SRC_CHOCDOOM_DOOM_H_ */ 43 | -------------------------------------------------------------------------------- /src/jpeg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * jpeg.h 3 | * 4 | * Created on: 19.05.2014 5 | * Author: Florian 6 | */ 7 | 8 | 9 | #ifndef JPEG_H_ 10 | #define JPEG_H_ 11 | 12 | /*---------------------------------------------------------------------* 13 | * additional includes * 14 | *---------------------------------------------------------------------*/ 15 | 16 | /*---------------------------------------------------------------------* 17 | * global definitions * 18 | *---------------------------------------------------------------------*/ 19 | 20 | /*---------------------------------------------------------------------* 21 | * type declarations * 22 | *---------------------------------------------------------------------*/ 23 | 24 | /*---------------------------------------------------------------------* 25 | * function prototypes * 26 | *---------------------------------------------------------------------*/ 27 | 28 | bool jpeg_decode (uint8_t* jpg, uint8_t* decoded, uint16_t xpos, uint16_t ypos); 29 | 30 | /*---------------------------------------------------------------------* 31 | * global data * 32 | *---------------------------------------------------------------------*/ 33 | 34 | /*---------------------------------------------------------------------* 35 | * inline functions and function-like macros * 36 | *---------------------------------------------------------------------*/ 37 | 38 | /*---------------------------------------------------------------------* 39 | * eof * 40 | *---------------------------------------------------------------------*/ 41 | 42 | #endif /* JPEG_H_ */ 43 | -------------------------------------------------------------------------------- /src/button.h: -------------------------------------------------------------------------------- 1 | /* 2 | * button.h 3 | * 4 | * Created on: 15.02.2015 5 | * Author: Florian 6 | */ 7 | 8 | 9 | #ifndef SRC_BUTTON_H_ 10 | #define SRC_BUTTON_H_ 11 | 12 | /*---------------------------------------------------------------------* 13 | * additional includes * 14 | *---------------------------------------------------------------------*/ 15 | 16 | /*---------------------------------------------------------------------* 17 | * global definitions * 18 | *---------------------------------------------------------------------*/ 19 | 20 | /*---------------------------------------------------------------------* 21 | * type declarations * 22 | *---------------------------------------------------------------------*/ 23 | 24 | /*---------------------------------------------------------------------* 25 | * function prototypes * 26 | *---------------------------------------------------------------------*/ 27 | 28 | void button_init (void); 29 | 30 | bool button_read (void); 31 | 32 | /*---------------------------------------------------------------------* 33 | * global data * 34 | *---------------------------------------------------------------------*/ 35 | 36 | /*---------------------------------------------------------------------* 37 | * inline functions and function-like macros * 38 | *---------------------------------------------------------------------*/ 39 | 40 | /*---------------------------------------------------------------------* 41 | * eof * 42 | *---------------------------------------------------------------------*/ 43 | 44 | #endif /* SRC_BUTTON_H_ */ 45 | -------------------------------------------------------------------------------- /memory.ld: -------------------------------------------------------------------------------- 1 | OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") 2 | 3 | /* Internal Memory Map*/ 4 | MEMORY 5 | { 6 | rom (rx) : ORIGIN = 0x08000000, LENGTH = 2048K 7 | ram (rwx) : ORIGIN = 0x20000000, LENGTH = 256K 8 | sdram (rwx) : ORIGIN = 0xD004B000, LENGTH = 7892K /* first 300K is used as LCD frame buffer */ 9 | } 10 | 11 | /* Section Definitions */ 12 | SECTIONS 13 | { 14 | /* external SDRAM */ 15 | .sdram (NOLOAD) : 16 | { 17 | . = ALIGN(4); 18 | *(.sdram .sdram.*) 19 | bin/chocdoom/i_video.o(COMMON) 20 | bin/chocdoom/r_bsp.o(COMMON) 21 | bin/chocdoom/w_wad.o(COMMON) 22 | bin/chocdoom/r_main.o(COMMON) 23 | bin/chocdoom/r_plane.o(COMMON) 24 | } > sdram 25 | 26 | /* program code */ 27 | .text : 28 | { 29 | KEEP(*(.isr_vector .isr_vector.*)) 30 | *(.text .text.* .gnu.linkonce.t.*) 31 | *(.glue_7t) *(.glue_7) 32 | *(.rodata .rodata* .gnu.linkonce.r.*) 33 | } > rom 34 | 35 | .ARM.extab : 36 | { 37 | *(.ARM.extab* .gnu.linkonce.armextab.*) 38 | } > rom 39 | 40 | __exidx_start = .; 41 | .ARM.exidx : 42 | { 43 | *(.ARM.exidx* .gnu.linkonce.armexidx.*) 44 | } > rom 45 | __exidx_end = .; 46 | 47 | . = ALIGN(4); 48 | _etext = .; 49 | _sidata = .; 50 | 51 | /* initialized data */ 52 | .data : AT (_etext) 53 | { 54 | _sdata = .; 55 | *(.data .data.*) 56 | . = ALIGN(4); 57 | _edata = . ; 58 | } > ram 59 | 60 | /* uninitialized data */ 61 | .bss (NOLOAD) : 62 | { 63 | _sbss = . ; 64 | *(.bss .bss.*) 65 | *(COMMON) 66 | . = ALIGN(4); 67 | _ebss = . ; 68 | } > ram 69 | 70 | /* stack section */ 71 | .stack (NOLOAD): 72 | { 73 | . = ALIGN(8); 74 | *(.stack .stack.*) 75 | } > ram 76 | 77 | /* heap section */ 78 | .heap (NOLOAD): 79 | { 80 | *(.heap .heap.*) 81 | } > ram 82 | 83 | . = ALIGN(4); 84 | _end = . ; 85 | } -------------------------------------------------------------------------------- /src/debug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * debug.h 3 | * 4 | * Created on: 24.11.2013 5 | * Author: Florian 6 | */ 7 | 8 | 9 | #ifndef DEBUG_H_ 10 | #define DEBUG_H_ 11 | 12 | /*---------------------------------------------------------------------* 13 | * additional includes * 14 | *---------------------------------------------------------------------*/ 15 | 16 | /*---------------------------------------------------------------------* 17 | * global definitions * 18 | *---------------------------------------------------------------------*/ 19 | 20 | /*---------------------------------------------------------------------* 21 | * type declarations * 22 | *---------------------------------------------------------------------*/ 23 | 24 | /*---------------------------------------------------------------------* 25 | * function prototypes * 26 | *---------------------------------------------------------------------*/ 27 | 28 | void debug_init (void); 29 | 30 | void debug_chr (char chr); 31 | 32 | /*---------------------------------------------------------------------* 33 | * global data * 34 | *---------------------------------------------------------------------*/ 35 | 36 | extern uint8_t debug_char; 37 | 38 | /*---------------------------------------------------------------------* 39 | * inline functions and function-like macros * 40 | *---------------------------------------------------------------------*/ 41 | 42 | /*---------------------------------------------------------------------* 43 | * eof * 44 | *---------------------------------------------------------------------*/ 45 | 46 | #endif /* DEBUG_H_ */ 47 | -------------------------------------------------------------------------------- /src/chocdoom/w_wad.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // WAD I/O functions. 17 | // 18 | 19 | 20 | #ifndef __W_WAD__ 21 | #define __W_WAD__ 22 | 23 | #include 24 | 25 | #include "doomtype.h" 26 | #include "d_mode.h" 27 | 28 | #include "w_file.h" 29 | 30 | 31 | // 32 | // TYPES 33 | // 34 | 35 | // 36 | // WADFILE I/O related stuff. 37 | // 38 | 39 | typedef struct lumpinfo_s lumpinfo_t; 40 | 41 | struct lumpinfo_s 42 | { 43 | char name[8]; 44 | wad_file_t *wad_file; 45 | int position; 46 | int size; 47 | void *cache; 48 | 49 | // Used for hash table lookups 50 | 51 | lumpinfo_t *next; 52 | }; 53 | 54 | 55 | extern lumpinfo_t *lumpinfo; 56 | extern unsigned int numlumps; 57 | 58 | wad_file_t *W_AddFile (char *filename); 59 | 60 | int W_CheckNumForName (char* name); 61 | int W_GetNumForName (char* name); 62 | 63 | int W_LumpLength (unsigned int lump); 64 | void W_ReadLump (unsigned int lump, void *dest); 65 | 66 | void* W_CacheLumpNum (int lump, int tag); 67 | void* W_CacheLumpName (char* name, int tag); 68 | 69 | void W_GenerateHashTable(void); 70 | 71 | extern unsigned int W_LumpNameHash(const char *s); 72 | 73 | void W_ReleaseLumpNum(int lump); 74 | void W_ReleaseLumpName(char *name); 75 | 76 | void W_CheckCorrectIWAD(GameMission_t mission); 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /src/images.h: -------------------------------------------------------------------------------- 1 | /* 2 | * images.h 3 | * 4 | * Created on: 06.06.2014 5 | * Author: Florian 6 | */ 7 | 8 | 9 | #ifndef IMAGES_H_ 10 | #define IMAGES_H_ 11 | 12 | /*---------------------------------------------------------------------* 13 | * additional includes * 14 | *---------------------------------------------------------------------*/ 15 | 16 | /*---------------------------------------------------------------------* 17 | * global definitions * 18 | *---------------------------------------------------------------------*/ 19 | 20 | /*---------------------------------------------------------------------* 21 | * type declarations * 22 | *---------------------------------------------------------------------*/ 23 | 24 | /*---------------------------------------------------------------------* 25 | * function prototypes * 26 | *---------------------------------------------------------------------*/ 27 | 28 | /*---------------------------------------------------------------------* 29 | * global data * 30 | *---------------------------------------------------------------------*/ 31 | 32 | extern const uint8_t img_loading[1965]; 33 | 34 | extern const uint8_t img_no_usb[7943]; 35 | 36 | extern const uint8_t img_keys[25608]; 37 | 38 | /*---------------------------------------------------------------------* 39 | * inline functions and function-like macros * 40 | *---------------------------------------------------------------------*/ 41 | 42 | /*---------------------------------------------------------------------* 43 | * eof * 44 | *---------------------------------------------------------------------*/ 45 | 46 | #endif /* IMAGES_H_ */ 47 | -------------------------------------------------------------------------------- /src/spi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * spi.h 3 | * 4 | * Created on: 07.06.2014 5 | * Author: Florian 6 | */ 7 | 8 | 9 | #ifndef SPI_H_ 10 | #define SPI_H_ 11 | 12 | /*---------------------------------------------------------------------* 13 | * additional includes * 14 | *---------------------------------------------------------------------*/ 15 | 16 | /*---------------------------------------------------------------------* 17 | * global definitions * 18 | *---------------------------------------------------------------------*/ 19 | 20 | /*---------------------------------------------------------------------* 21 | * type declarations * 22 | *---------------------------------------------------------------------*/ 23 | 24 | /*---------------------------------------------------------------------* 25 | * function prototypes * 26 | *---------------------------------------------------------------------*/ 27 | 28 | void spi_init (void); 29 | 30 | uint8_t spi_send_receive (uint8_t data); 31 | 32 | void spi_send (uint8_t data); 33 | 34 | uint8_t spi_receive (void); 35 | 36 | /*---------------------------------------------------------------------* 37 | * global data * 38 | *---------------------------------------------------------------------*/ 39 | 40 | /*---------------------------------------------------------------------* 41 | * inline functions and function-like macros * 42 | *---------------------------------------------------------------------*/ 43 | 44 | /*---------------------------------------------------------------------* 45 | * eof * 46 | *---------------------------------------------------------------------*/ 47 | 48 | #endif /* SPI_H_ */ 49 | -------------------------------------------------------------------------------- /src/sdram.h: -------------------------------------------------------------------------------- 1 | /* 2 | * sdram.h 3 | * 4 | * Created on: 26.05.2014 5 | * Author: Florian 6 | */ 7 | 8 | 9 | #ifndef SDRAM_H_ 10 | #define SDRAM_H_ 11 | 12 | /*---------------------------------------------------------------------* 13 | * additional includes * 14 | *---------------------------------------------------------------------*/ 15 | 16 | /*---------------------------------------------------------------------* 17 | * global definitions * 18 | *---------------------------------------------------------------------*/ 19 | 20 | #define SDRAM_START_ADR ((uint32_t)0xD0000000) 21 | 22 | /*---------------------------------------------------------------------* 23 | * type declarations * 24 | *---------------------------------------------------------------------*/ 25 | 26 | /*---------------------------------------------------------------------* 27 | * function prototypes * 28 | *---------------------------------------------------------------------*/ 29 | 30 | void sdram_init (void); 31 | 32 | void sdram_memtest (uint8_t* data, uint32_t length); 33 | 34 | /*---------------------------------------------------------------------* 35 | * global data * 36 | *---------------------------------------------------------------------*/ 37 | 38 | /*---------------------------------------------------------------------* 39 | * inline functions and function-like macros * 40 | *---------------------------------------------------------------------*/ 41 | 42 | /*---------------------------------------------------------------------* 43 | * eof * 44 | *---------------------------------------------------------------------*/ 45 | 46 | #endif /* SDRAM_H_ */ 47 | -------------------------------------------------------------------------------- /lib/usb/usbh_conf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * usbh_conf.h 3 | * 4 | * Created on: 21.03.2015 5 | * Author: Florian 6 | */ 7 | 8 | 9 | #ifndef LIB_USB_USBH_CONF_H_ 10 | #define LIB_USB_USBH_CONF_H_ 11 | 12 | /*---------------------------------------------------------------------* 13 | * additional includes * 14 | *---------------------------------------------------------------------*/ 15 | 16 | /*---------------------------------------------------------------------* 17 | * global definitions * 18 | *---------------------------------------------------------------------*/ 19 | 20 | #define USBH_MAX_NUM_ENDPOINTS 2 21 | #define USBH_MAX_NUM_INTERFACES 2 22 | 23 | #define USBH_MSC_MPS_SIZE 0x200 24 | 25 | /*---------------------------------------------------------------------* 26 | * type declarations * 27 | *---------------------------------------------------------------------*/ 28 | 29 | /*---------------------------------------------------------------------* 30 | * function prototypes * 31 | *---------------------------------------------------------------------*/ 32 | 33 | /*---------------------------------------------------------------------* 34 | * global data * 35 | *---------------------------------------------------------------------*/ 36 | 37 | /*---------------------------------------------------------------------* 38 | * inline functions and function-like macros * 39 | *---------------------------------------------------------------------*/ 40 | 41 | /*---------------------------------------------------------------------* 42 | * eof * 43 | *---------------------------------------------------------------------*/ 44 | 45 | #endif /* LIB_USB_USBH_CONF_H_ */ 46 | -------------------------------------------------------------------------------- /src/chocdoom/i_endoom.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 2005-2014 Simon Howard 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // DESCRIPTION: 15 | // Exit text-mode ENDOOM screen. 16 | // 17 | 18 | #include 19 | #include 20 | 21 | #include "config.h" 22 | #include "doomtype.h" 23 | #include "i_video.h" 24 | 25 | #ifdef ORIGCODE 26 | #include "txt_main.h" 27 | #endif 28 | 29 | #define ENDOOM_W 80 30 | #define ENDOOM_H 25 31 | 32 | // 33 | // Displays the text mode ending screen after the game quits 34 | // 35 | 36 | void I_Endoom(byte *endoom_data) 37 | { 38 | #ifdef ORIGCODE 39 | unsigned char *screendata; 40 | int y; 41 | int indent; 42 | 43 | // Set up text mode screen 44 | 45 | TXT_Init(); 46 | I_InitWindowTitle(); 47 | I_InitWindowIcon(); 48 | 49 | // Write the data to the screen memory 50 | 51 | screendata = TXT_GetScreenData(); 52 | 53 | indent = (ENDOOM_W - TXT_SCREEN_W) / 2; 54 | 55 | for (y=0; y 0) 69 | { 70 | break; 71 | } 72 | 73 | TXT_Sleep(0); 74 | } 75 | 76 | // Shut down text mode screen 77 | 78 | TXT_Shutdown(); 79 | #endif 80 | } 81 | 82 | -------------------------------------------------------------------------------- /lib/fatfs/fatfs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * fatfs.h 3 | * 4 | * Created on: 20.02.2015 5 | * Author: Florian 6 | */ 7 | 8 | 9 | #ifndef FATFS_H_ 10 | #define FATFS_H_ 11 | 12 | /*---------------------------------------------------------------------* 13 | * additional includes * 14 | *---------------------------------------------------------------------*/ 15 | 16 | #include "diskio.h" 17 | 18 | /*---------------------------------------------------------------------* 19 | * global definitions * 20 | *---------------------------------------------------------------------*/ 21 | 22 | /*---------------------------------------------------------------------* 23 | * type declarations * 24 | *---------------------------------------------------------------------*/ 25 | 26 | /*---------------------------------------------------------------------* 27 | * function prototypes * 28 | *---------------------------------------------------------------------*/ 29 | 30 | void fatfs_init (void); 31 | bool fatfs_check_media (diskio_media_t dev); 32 | bool fatfs_mount (diskio_media_t dev); 33 | bool fatfs_unmount (diskio_media_t dev); 34 | 35 | /*---------------------------------------------------------------------* 36 | * global data * 37 | *---------------------------------------------------------------------*/ 38 | 39 | /*---------------------------------------------------------------------* 40 | * inline functions and function-like macros * 41 | *---------------------------------------------------------------------*/ 42 | 43 | /*---------------------------------------------------------------------* 44 | * eof * 45 | *---------------------------------------------------------------------*/ 46 | 47 | #endif /* FATFS_H_ */ 48 | -------------------------------------------------------------------------------- /src/chocdoom/m_misc.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Miscellaneous. 17 | // 18 | 19 | 20 | #ifndef __M_MISC__ 21 | #define __M_MISC__ 22 | 23 | #include 24 | #include 25 | 26 | #include "doomtype.h" 27 | #include "ff.h" 28 | 29 | boolean M_WriteFile(char *name, void *source, int length); 30 | int M_ReadFile(char *name, byte **buffer); 31 | void M_MakeDirectory(char *dir); 32 | char *M_TempFile(char *s); 33 | boolean M_FileExists(char *file); 34 | #if ORIGCODE 35 | long M_FileLength(FILE *handle); 36 | #else 37 | long M_FileLength(FIL *handle); 38 | #endif 39 | boolean M_StrToInt(const char *str, int *result); 40 | void M_ExtractFileBase(char *path, char *dest); 41 | void M_ForceUppercase(char *text); 42 | char *M_StrCaseStr(char *haystack, char *needle); 43 | boolean M_StringCopy(char *dest, const char *src, size_t dest_size); 44 | boolean M_StringConcat(char *dest, const char *src, size_t dest_size); 45 | char *M_StringReplace(const char *haystack, const char *needle, 46 | const char *replacement); 47 | char *M_StringJoin(const char *s, ...); 48 | boolean M_StringStartsWith(const char *s, const char *prefix); 49 | boolean M_StringEndsWith(const char *s, const char *suffix); 50 | int M_vsnprintf(char *buf, size_t buf_len, const char *s, va_list args); 51 | int M_snprintf(char *buf, size_t buf_len, const char *s, ...); 52 | char *M_OEMToUTF8(const char *ansi); 53 | 54 | #endif 55 | 56 | -------------------------------------------------------------------------------- /src/font.c: -------------------------------------------------------------------------------- 1 | /* 2 | * font.c 3 | * 4 | * Created on: 23.10.2014 5 | * Author: Florian 6 | */ 7 | 8 | 9 | /*---------------------------------------------------------------------* 10 | * include files * 11 | *---------------------------------------------------------------------*/ 12 | 13 | #include 14 | #include 15 | #include "font.h" 16 | 17 | /*---------------------------------------------------------------------* 18 | * local definitions * 19 | *---------------------------------------------------------------------*/ 20 | 21 | /*---------------------------------------------------------------------* 22 | * external declarations * 23 | *---------------------------------------------------------------------*/ 24 | 25 | /*---------------------------------------------------------------------* 26 | * public data * 27 | *---------------------------------------------------------------------*/ 28 | 29 | /*---------------------------------------------------------------------* 30 | * private data * 31 | *---------------------------------------------------------------------*/ 32 | 33 | /*---------------------------------------------------------------------* 34 | * private functions * 35 | *---------------------------------------------------------------------*/ 36 | 37 | /*---------------------------------------------------------------------* 38 | * public functions * 39 | *---------------------------------------------------------------------*/ 40 | 41 | /*---------------------------------------------------------------------* 42 | * eof * 43 | *---------------------------------------------------------------------*/ 44 | -------------------------------------------------------------------------------- /src/main.h: -------------------------------------------------------------------------------- 1 | /* 2 | * main.h 3 | * 4 | * Created on: 13.05.2014 5 | * Author: Florian 6 | */ 7 | 8 | #ifndef MAIN_H_ 9 | #define MAIN_H_ 10 | 11 | /*---------------------------------------------------------------------* 12 | * additional includes * 13 | *---------------------------------------------------------------------*/ 14 | 15 | /*---------------------------------------------------------------------* 16 | * global definitions * 17 | *---------------------------------------------------------------------*/ 18 | 19 | #define elements_in(t) (sizeof (t) / sizeof (t[0])) 20 | 21 | /*---------------------------------------------------------------------* 22 | * type declarations * 23 | *---------------------------------------------------------------------*/ 24 | 25 | /*---------------------------------------------------------------------* 26 | * function prototypes * 27 | *---------------------------------------------------------------------*/ 28 | 29 | int main (void); 30 | 31 | void sleep_ms (uint32_t ms); 32 | 33 | void fatal_error (const char* message) __attribute__ ((noreturn)); 34 | 35 | /*---------------------------------------------------------------------* 36 | * global data * 37 | *---------------------------------------------------------------------*/ 38 | 39 | extern volatile uint32_t systime; 40 | 41 | /*---------------------------------------------------------------------* 42 | * inline functions and function-like macros * 43 | *---------------------------------------------------------------------*/ 44 | 45 | /*---------------------------------------------------------------------* 46 | * eof * 47 | *---------------------------------------------------------------------*/ 48 | 49 | #endif /* MAIN_H_ */ 50 | -------------------------------------------------------------------------------- /src/led.h: -------------------------------------------------------------------------------- 1 | /* 2 | * led.h 3 | * 4 | * Created on: 16.05.2014 5 | * Author: Florian 6 | */ 7 | 8 | 9 | #ifndef LED_H_ 10 | #define LED_H_ 11 | 12 | /*---------------------------------------------------------------------* 13 | * additional includes * 14 | *---------------------------------------------------------------------*/ 15 | 16 | /*---------------------------------------------------------------------* 17 | * global definitions * 18 | *---------------------------------------------------------------------*/ 19 | 20 | /*---------------------------------------------------------------------* 21 | * type declarations * 22 | *---------------------------------------------------------------------*/ 23 | 24 | typedef enum 25 | { 26 | LED_GREEN, 27 | LED_RED 28 | } led_t; 29 | 30 | typedef enum 31 | { 32 | LED_STATE_ON, 33 | LED_STATE_OFF 34 | } led_state_t; 35 | 36 | /*---------------------------------------------------------------------* 37 | * function prototypes * 38 | *---------------------------------------------------------------------*/ 39 | 40 | void led_init (void); 41 | 42 | void led_set (led_t led, led_state_t led_state); 43 | 44 | /*---------------------------------------------------------------------* 45 | * global data * 46 | *---------------------------------------------------------------------*/ 47 | 48 | /*---------------------------------------------------------------------* 49 | * inline functions and function-like macros * 50 | *---------------------------------------------------------------------*/ 51 | 52 | /*---------------------------------------------------------------------* 53 | * eof * 54 | *---------------------------------------------------------------------*/ 55 | 56 | #endif /* LED_H_ */ 57 | -------------------------------------------------------------------------------- /src/chocdoom/dummy.c: -------------------------------------------------------------------------------- 1 | /* 2 | * dummy.c 3 | * 4 | * Created on: 16.02.2015 5 | * Author: Florian 6 | */ 7 | 8 | 9 | /*---------------------------------------------------------------------* 10 | * include files * 11 | *---------------------------------------------------------------------*/ 12 | 13 | #include "doomtype.h" 14 | 15 | /*---------------------------------------------------------------------* 16 | * local definitions * 17 | *---------------------------------------------------------------------*/ 18 | 19 | /*---------------------------------------------------------------------* 20 | * external declarations * 21 | *---------------------------------------------------------------------*/ 22 | 23 | /*---------------------------------------------------------------------* 24 | * public data * 25 | *---------------------------------------------------------------------*/ 26 | 27 | boolean net_client_connected = false; 28 | 29 | boolean drone = false; 30 | 31 | /*---------------------------------------------------------------------* 32 | * private data * 33 | *---------------------------------------------------------------------*/ 34 | 35 | /*---------------------------------------------------------------------* 36 | * private functions * 37 | *---------------------------------------------------------------------*/ 38 | 39 | /*---------------------------------------------------------------------* 40 | * public functions * 41 | *---------------------------------------------------------------------*/ 42 | 43 | void I_InitTimidityConfig(void) 44 | { 45 | } 46 | 47 | /*---------------------------------------------------------------------* 48 | * eof * 49 | *---------------------------------------------------------------------*/ 50 | -------------------------------------------------------------------------------- /src/i2c.h: -------------------------------------------------------------------------------- 1 | /* 2 | * i2c.h 3 | * 4 | * Created on: 31.05.2014 5 | * Author: Florian 6 | */ 7 | 8 | 9 | #ifndef I2C_H_ 10 | #define I2C_H_ 11 | 12 | /*---------------------------------------------------------------------* 13 | * additional includes * 14 | *---------------------------------------------------------------------*/ 15 | 16 | /*---------------------------------------------------------------------* 17 | * global definitions * 18 | *---------------------------------------------------------------------*/ 19 | 20 | /*---------------------------------------------------------------------* 21 | * type declarations * 22 | *---------------------------------------------------------------------*/ 23 | 24 | /*---------------------------------------------------------------------* 25 | * function prototypes * 26 | *---------------------------------------------------------------------*/ 27 | 28 | void i2c_init (void); 29 | 30 | uint8_t i2c_read_byte (uint8_t slave_adr, uint8_t adr); 31 | 32 | bool i2c_write_byte (uint8_t slave_adr, uint8_t adr, uint8_t data); 33 | 34 | bool i2c_read_bytes (uint8_t slave_adr, uint8_t adr, uint8_t* buf, uint8_t cnt); 35 | 36 | bool i2c_write_bytes (uint8_t slave_adr, uint8_t adr, uint8_t* buf, uint8_t cnt); 37 | 38 | /*---------------------------------------------------------------------* 39 | * global data * 40 | *---------------------------------------------------------------------*/ 41 | 42 | /*---------------------------------------------------------------------* 43 | * inline functions and function-like macros * 44 | *---------------------------------------------------------------------*/ 45 | 46 | /*---------------------------------------------------------------------* 47 | * eof * 48 | *---------------------------------------------------------------------*/ 49 | 50 | #endif /* I2C_H_ */ 51 | -------------------------------------------------------------------------------- /src/touch.h: -------------------------------------------------------------------------------- 1 | /* 2 | * touch.h 3 | * 4 | * Created on: 09.06.2014 5 | * Author: Florian 6 | */ 7 | 8 | 9 | #ifndef TOUCH_H_ 10 | #define TOUCH_H_ 11 | 12 | /*---------------------------------------------------------------------* 13 | * additional includes * 14 | *---------------------------------------------------------------------*/ 15 | 16 | /*---------------------------------------------------------------------* 17 | * global definitions * 18 | *---------------------------------------------------------------------*/ 19 | 20 | /*---------------------------------------------------------------------* 21 | * type declarations * 22 | *---------------------------------------------------------------------*/ 23 | 24 | typedef enum 25 | { 26 | TOUCH_PRESSED, 27 | TOUCH_RELEASED 28 | } touch_status_t; 29 | 30 | typedef struct 31 | { 32 | touch_status_t status; 33 | uint16_t x; 34 | uint16_t y; 35 | } touch_state_t; 36 | 37 | /*---------------------------------------------------------------------* 38 | * function prototypes * 39 | *---------------------------------------------------------------------*/ 40 | 41 | void touch_init (void); 42 | 43 | void touch_main (void); 44 | 45 | void touch_read (void); 46 | 47 | uint8_t touch_read_temperature (void); 48 | 49 | /*---------------------------------------------------------------------* 50 | * global data * 51 | *---------------------------------------------------------------------*/ 52 | 53 | extern touch_state_t touch_state; 54 | 55 | /*---------------------------------------------------------------------* 56 | * inline functions and function-like macros * 57 | *---------------------------------------------------------------------*/ 58 | 59 | /*---------------------------------------------------------------------* 60 | * eof * 61 | *---------------------------------------------------------------------*/ 62 | 63 | #endif /* TOUCH_H_ */ 64 | -------------------------------------------------------------------------------- /src/chocdoom/g_game.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Duh. 17 | // 18 | 19 | 20 | #ifndef __G_GAME__ 21 | #define __G_GAME__ 22 | 23 | #include "doomdef.h" 24 | #include "d_event.h" 25 | #include "d_ticcmd.h" 26 | 27 | 28 | // 29 | // GAME 30 | // 31 | void G_DeathMatchSpawnPlayer (int playernum); 32 | 33 | void G_InitNew (skill_t skill, int episode, int map); 34 | 35 | // Can be called by the startup code or M_Responder. 36 | // A normal game starts at map 1, 37 | // but a warp test can start elsewhere 38 | void G_DeferedInitNew (skill_t skill, int episode, int map); 39 | 40 | void G_DeferedPlayDemo (char* demo); 41 | 42 | // Can be called by the startup code or M_Responder, 43 | // calls P_SetupLevel or W_EnterWorld. 44 | void G_LoadGame (char* name); 45 | 46 | void G_DoLoadGame (void); 47 | 48 | // Called by M_Responder. 49 | void G_SaveGame (int slot, char* description); 50 | 51 | // Only called by startup code. 52 | void G_RecordDemo (char* name); 53 | 54 | void G_BeginRecording (void); 55 | 56 | void G_PlayDemo (char* name); 57 | void G_TimeDemo (char* name); 58 | boolean G_CheckDemoStatus (void); 59 | 60 | void G_ExitLevel (void); 61 | void G_SecretExitLevel (void); 62 | 63 | void G_WorldDone (void); 64 | 65 | // Read current data from inputs and build a player movement command. 66 | 67 | void G_BuildTiccmd (ticcmd_t *cmd, int maketic); 68 | 69 | void G_Ticker (void); 70 | boolean G_Responder (event_t* ev); 71 | 72 | void G_ScreenShot (void); 73 | 74 | void G_DrawMouseSpeedBox(void); 75 | int G_VanillaVersionCode(void); 76 | 77 | extern int vanilla_savegame_limit; 78 | extern int vanilla_demo_limit; 79 | #endif 80 | 81 | -------------------------------------------------------------------------------- /src/font.h: -------------------------------------------------------------------------------- 1 | /* 2 | * font.h 3 | * 4 | * Created on: 09.02.2013 5 | * Author: Florian 6 | */ 7 | 8 | #ifndef FONT_H_ 9 | #define FONT_H_ 10 | 11 | /*---------------------------------------------------------------------* 12 | * additional includes * 13 | *---------------------------------------------------------------------*/ 14 | 15 | /*---------------------------------------------------------------------* 16 | * global definitions * 17 | *---------------------------------------------------------------------*/ 18 | 19 | /*---------------------------------------------------------------------* 20 | * type declarations * 21 | *---------------------------------------------------------------------*/ 22 | 23 | typedef struct 24 | { 25 | uint8_t line_space; // space between vertical lines 26 | uint8_t char_space; // space between individual characters 27 | 28 | uint8_t char_height; // average character height 29 | uint8_t char_width; // character width (only used with bitmap fonts) 30 | 31 | bool bitmap_font; 32 | uint16_t offsets[105]; // character offsets within chars[] 33 | uint8_t chars[]; // character data 34 | } gfx_font_t; 35 | 36 | /*---------------------------------------------------------------------* 37 | * function prototypes * 38 | *---------------------------------------------------------------------*/ 39 | 40 | /*---------------------------------------------------------------------* 41 | * global data * 42 | *---------------------------------------------------------------------*/ 43 | 44 | /*---------------------------------------------------------------------* 45 | * inline functions and function-like macros * 46 | *---------------------------------------------------------------------*/ 47 | 48 | /*---------------------------------------------------------------------* 49 | * eof * 50 | *---------------------------------------------------------------------*/ 51 | 52 | #endif /* FONT_H_ */ 53 | -------------------------------------------------------------------------------- /src/chocdoom/w_file.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // WAD I/O functions. 17 | // 18 | 19 | #include 20 | 21 | #include "config.h" 22 | 23 | #include "doomtype.h" 24 | #include "m_argv.h" 25 | 26 | #include "w_file.h" 27 | 28 | extern wad_file_class_t stdc_wad_file; 29 | 30 | #ifdef _WIN32 31 | extern wad_file_class_t win32_wad_file; 32 | #endif 33 | 34 | #ifdef HAVE_MMAP 35 | extern wad_file_class_t posix_wad_file; 36 | #endif 37 | 38 | static wad_file_class_t *wad_file_classes[] = 39 | { 40 | #ifdef _WIN32 41 | &win32_wad_file, 42 | #endif 43 | #ifdef HAVE_MMAP 44 | &posix_wad_file, 45 | #endif 46 | &stdc_wad_file, 47 | }; 48 | 49 | wad_file_t *W_OpenFile(char *path) 50 | { 51 | wad_file_t *result; 52 | int i; 53 | 54 | //! 55 | // Use the OS's virtual memory subsystem to map WAD files 56 | // directly into memory. 57 | // 58 | 59 | if (!M_CheckParm("-mmap")) 60 | { 61 | return stdc_wad_file.OpenFile(path); 62 | } 63 | 64 | // Try all classes in order until we find one that works 65 | 66 | result = NULL; 67 | 68 | for (i = 0; i < arrlen(wad_file_classes); ++i) 69 | { 70 | result = wad_file_classes[i]->OpenFile(path); 71 | 72 | if (result != NULL) 73 | { 74 | break; 75 | } 76 | } 77 | 78 | return result; 79 | } 80 | 81 | void W_CloseFile(wad_file_t *wad) 82 | { 83 | wad->file_class->CloseFile(wad); 84 | } 85 | 86 | size_t W_Read(wad_file_t *wad, unsigned int offset, 87 | void *buffer, size_t buffer_len) 88 | { 89 | return wad->file_class->Read(wad, offset, buffer, buffer_len); 90 | } 91 | 92 | -------------------------------------------------------------------------------- /src/chocdoom/s_sound.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // The not so system specific sound interface. 17 | // 18 | 19 | 20 | #ifndef __S_SOUND__ 21 | #define __S_SOUND__ 22 | 23 | #include "p_mobj.h" 24 | #include "sounds.h" 25 | 26 | // 27 | // Initializes sound stuff, including volume 28 | // Sets channels, SFX and music volume, 29 | // allocates channel buffer, sets S_sfx lookup. 30 | // 31 | 32 | void S_Init(int sfxVolume, int musicVolume); 33 | 34 | 35 | // Shut down sound 36 | 37 | void S_Shutdown(void); 38 | 39 | 40 | 41 | // 42 | // Per level startup code. 43 | // Kills playing sounds at start of level, 44 | // determines music if any, changes music. 45 | // 46 | 47 | void S_Start(void); 48 | 49 | // 50 | // Start sound for thing at 51 | // using from sounds.h 52 | // 53 | 54 | void S_StartSound(void *origin, int sound_id); 55 | 56 | // Stop sound for thing at 57 | void S_StopSound(mobj_t *origin); 58 | 59 | 60 | // Start music using from sounds.h 61 | void S_StartMusic(int music_id); 62 | 63 | // Start music using from sounds.h, 64 | // and set whether looping 65 | void S_ChangeMusic(int music_id, int looping); 66 | 67 | // query if music is playing 68 | boolean S_MusicPlaying(void); 69 | 70 | // Stops the music fer sure. 71 | void S_StopMusic(void); 72 | 73 | // Stop and resume music, during game PAUSE. 74 | void S_PauseSound(void); 75 | void S_ResumeSound(void); 76 | 77 | 78 | // 79 | // Updates music & sounds 80 | // 81 | void S_UpdateSounds(mobj_t *listener); 82 | 83 | void S_SetMusicVolume(int volume); 84 | void S_SetSfxVolume(int volume); 85 | 86 | extern int snd_channels; 87 | 88 | #endif 89 | 90 | -------------------------------------------------------------------------------- /src/chocdoom/st_stuff.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Status bar code. 17 | // Does the face/direction indicator animatin. 18 | // Does palette indicators as well (red pain/berserk, bright pickup) 19 | // 20 | 21 | #ifndef __STSTUFF_H__ 22 | #define __STSTUFF_H__ 23 | 24 | #include "doomtype.h" 25 | #include "d_event.h" 26 | #include "m_cheat.h" 27 | 28 | // Size of statusbar. 29 | // Now sensitive for scaling. 30 | #define ST_HEIGHT 32 31 | #define ST_WIDTH SCREENWIDTH 32 | #define ST_Y (SCREENHEIGHT - ST_HEIGHT) 33 | 34 | 35 | // 36 | // STATUS BAR 37 | // 38 | 39 | // Called by main loop. 40 | boolean ST_Responder (event_t* ev); 41 | 42 | // Called by main loop. 43 | void ST_Ticker (void); 44 | 45 | // Called by main loop. 46 | void ST_Drawer (boolean fullscreen, boolean refresh); 47 | 48 | // Called when the console player is spawned on each level. 49 | void ST_Start (void); 50 | 51 | // Called by startup code. 52 | void ST_Init (void); 53 | 54 | 55 | 56 | // States for status bar code. 57 | typedef enum 58 | { 59 | AutomapState, 60 | FirstPersonState 61 | 62 | } st_stateenum_t; 63 | 64 | 65 | // States for the chat code. 66 | typedef enum 67 | { 68 | StartChatState, 69 | WaitDestState, 70 | GetChatState 71 | 72 | } st_chatstateenum_t; 73 | 74 | 75 | 76 | extern byte *st_backing_screen; 77 | extern cheatseq_t cheat_mus; 78 | extern cheatseq_t cheat_god; 79 | extern cheatseq_t cheat_ammo; 80 | extern cheatseq_t cheat_ammonokey; 81 | extern cheatseq_t cheat_noclip; 82 | extern cheatseq_t cheat_commercial_noclip; 83 | extern cheatseq_t cheat_powerup[7]; 84 | extern cheatseq_t cheat_choppers; 85 | extern cheatseq_t cheat_clev; 86 | extern cheatseq_t cheat_mypos; 87 | 88 | 89 | #endif 90 | -------------------------------------------------------------------------------- /src/chocdoom/w_file.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // WAD I/O functions. 17 | // 18 | 19 | 20 | #ifndef __W_FILE__ 21 | #define __W_FILE__ 22 | 23 | #include 24 | #include "doomtype.h" 25 | 26 | typedef struct _wad_file_s wad_file_t; 27 | 28 | typedef struct 29 | { 30 | // Open a file for reading. 31 | 32 | wad_file_t *(*OpenFile)(char *path); 33 | 34 | // Close the specified file. 35 | 36 | void (*CloseFile)(wad_file_t *file); 37 | 38 | // Read data from the specified position in the file into the 39 | // provided buffer. Returns the number of bytes read. 40 | 41 | size_t (*Read)(wad_file_t *file, unsigned int offset, 42 | void *buffer, size_t buffer_len); 43 | 44 | } wad_file_class_t; 45 | 46 | struct _wad_file_s 47 | { 48 | // Class of this file. 49 | 50 | wad_file_class_t *file_class; 51 | 52 | // If this is NULL, the file cannot be mapped into memory. If this 53 | // is non-NULL, it is a pointer to the mapped file. 54 | 55 | byte *mapped; 56 | 57 | // Length of the file, in bytes. 58 | 59 | unsigned int length; 60 | }; 61 | 62 | // Open the specified file. Returns a pointer to a new wad_file_t 63 | // handle for the WAD file, or NULL if it could not be opened. 64 | 65 | wad_file_t *W_OpenFile(char *path); 66 | 67 | // Close the specified WAD file. 68 | 69 | void W_CloseFile(wad_file_t *wad); 70 | 71 | // Read data from the specified file into the provided buffer. The 72 | // data is read from the specified offset from the start of the file. 73 | // Returns the number of bytes read. 74 | 75 | size_t W_Read(wad_file_t *wad, unsigned int offset, 76 | void *buffer, size_t buffer_len); 77 | 78 | #endif /* #ifndef __W_FILE__ */ 79 | -------------------------------------------------------------------------------- /src/lcd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * lcd.h 3 | * 4 | * Created on: 07.06.2014 5 | * Author: Florian 6 | */ 7 | 8 | 9 | #ifndef LCD_H_ 10 | #define LCD_H_ 11 | 12 | /*---------------------------------------------------------------------* 13 | * additional includes * 14 | *---------------------------------------------------------------------*/ 15 | 16 | /*---------------------------------------------------------------------* 17 | * global definitions * 18 | *---------------------------------------------------------------------*/ 19 | 20 | /* rotate display by 180 degrees */ 21 | //#define LCD_UPSIDE_DOWN 22 | 23 | #define LCD_MAX_X 240 // LCD width 24 | #define LCD_MAX_Y 320 // LCD height 25 | 26 | /*---------------------------------------------------------------------* 27 | * type declarations * 28 | *---------------------------------------------------------------------*/ 29 | 30 | typedef enum 31 | { 32 | LCD_BACKGROUND, 33 | LCD_FOREGROUND 34 | } lcd_layers_t; 35 | 36 | /*---------------------------------------------------------------------* 37 | * function prototypes * 38 | *---------------------------------------------------------------------*/ 39 | 40 | void lcd_init (void); 41 | 42 | void lcd_set_layer (lcd_layers_t layer); 43 | 44 | void lcd_refresh (void); 45 | 46 | void lcd_set_transparency (lcd_layers_t layer, uint8_t transparency); 47 | 48 | /*---------------------------------------------------------------------* 49 | * global data * 50 | *---------------------------------------------------------------------*/ 51 | 52 | extern uint32_t lcd_frame_buffer; 53 | 54 | extern lcd_layers_t lcd_layer; 55 | 56 | extern bool lcd_vsync; 57 | 58 | /*---------------------------------------------------------------------* 59 | * inline functions and function-like macros * 60 | *---------------------------------------------------------------------*/ 61 | 62 | /*---------------------------------------------------------------------* 63 | * eof * 64 | *---------------------------------------------------------------------*/ 65 | 66 | #endif /* LCD_H_ */ 67 | -------------------------------------------------------------------------------- /src/chocdoom/z_zone.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Zone Memory Allocation, perhaps NeXT ObjectiveC inspired. 17 | // Remark: this was the only stuff that, according 18 | // to John Carmack, might have been useful for 19 | // Quake. 20 | // 21 | 22 | 23 | 24 | #ifndef __Z_ZONE__ 25 | #define __Z_ZONE__ 26 | 27 | #include 28 | 29 | // 30 | // ZONE MEMORY 31 | // PU - purge tags. 32 | 33 | enum 34 | { 35 | PU_STATIC = 1, // static entire execution time 36 | PU_SOUND, // static while playing 37 | PU_MUSIC, // static while playing 38 | PU_FREE, // a free block 39 | PU_LEVEL, // static until level exited 40 | PU_LEVSPEC, // a special thinker in a level 41 | 42 | // Tags >= PU_PURGELEVEL are purgable whenever needed. 43 | 44 | PU_PURGELEVEL, 45 | PU_CACHE, 46 | 47 | // Total number of different tag types 48 | 49 | PU_NUM_TAGS 50 | }; 51 | 52 | 53 | void Z_Init (void); 54 | void* Z_Malloc (int size, int tag, void *ptr); 55 | void Z_Free (void *ptr); 56 | void Z_FreeTags (int lowtag, int hightag); 57 | void Z_DumpHeap (int lowtag, int hightag); 58 | void Z_FileDumpHeap (FILE *f); 59 | void Z_CheckHeap (void); 60 | void Z_ChangeTag2 (void *ptr, int tag, char *file, int line); 61 | void Z_ChangeUser(void *ptr, void **user); 62 | int Z_FreeMemory (void); 63 | unsigned int Z_ZoneSize(void); 64 | 65 | // 66 | // This is used to get the local FILE:LINE info from CPP 67 | // prior to really call the function in question. 68 | // 69 | #define Z_ChangeTag(p,t) \ 70 | Z_ChangeTag2((p), (t), __FILE__, __LINE__) 71 | 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /lib/usb/usb_msc_host.h: -------------------------------------------------------------------------------- 1 | /* 2 | * usb_msc_host.h 3 | * 4 | * Created on: 21.03.2015 5 | * Author: Florian 6 | */ 7 | 8 | 9 | #ifndef LIB_USB_USB_MSC_HOST_H_ 10 | #define LIB_USB_USB_MSC_HOST_H_ 11 | 12 | /*---------------------------------------------------------------------* 13 | * additional includes * 14 | *---------------------------------------------------------------------*/ 15 | 16 | /*---------------------------------------------------------------------* 17 | * global definitions * 18 | *---------------------------------------------------------------------*/ 19 | 20 | /*---------------------------------------------------------------------* 21 | * type declarations * 22 | *---------------------------------------------------------------------*/ 23 | 24 | typedef enum 25 | { 26 | USB_MSC_HOST_NO_INIT = 0, // USB interface not initialized 27 | USB_MSC_DEV_DETACHED, // no device connected 28 | USB_MSC_SPEED_ERROR, // unsupported USB speed 29 | USB_MSC_DEV_NOT_SUPPORTED, // unsupported device 30 | USB_MSC_DEV_WRITE_PROTECT, // device is write protected 31 | USB_MSC_OVER_CURRENT, // overcurrent detected 32 | USB_MSC_DEV_CONNECTED // device connected and ready 33 | } usb_msc_host_status_t; 34 | 35 | /*---------------------------------------------------------------------* 36 | * function prototypes * 37 | *---------------------------------------------------------------------*/ 38 | 39 | void usb_msc_host_init (void); 40 | usb_msc_host_status_t usb_msc_host_main (void); 41 | 42 | /*---------------------------------------------------------------------* 43 | * global data * 44 | *---------------------------------------------------------------------*/ 45 | 46 | extern usb_msc_host_status_t usb_msc_host_status; 47 | 48 | /*---------------------------------------------------------------------* 49 | * inline functions and function-like macros * 50 | *---------------------------------------------------------------------*/ 51 | 52 | /*---------------------------------------------------------------------* 53 | * eof * 54 | *---------------------------------------------------------------------*/ 55 | 56 | #endif /* LIB_USB_USB_MSC_HOST_H_ */ 57 | -------------------------------------------------------------------------------- /src/chocdoom/i_system.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // System specific interface stuff. 17 | // 18 | 19 | 20 | #ifndef __I_SYSTEM__ 21 | #define __I_SYSTEM__ 22 | 23 | #include "d_ticcmd.h" 24 | #include "d_event.h" 25 | 26 | 27 | typedef void (*atexit_func_t)(void); 28 | 29 | // Called by DoomMain. 30 | void I_Init (void); 31 | 32 | // Called by startup code 33 | // to get the ammount of memory to malloc 34 | // for the zone management. 35 | byte* I_ZoneBase (int *size); 36 | 37 | boolean I_ConsoleStdout(void); 38 | 39 | 40 | // Asynchronous interrupt functions should maintain private queues 41 | // that are read by the synchronous functions 42 | // to be converted into events. 43 | 44 | // Either returns a null ticcmd, 45 | // or calls a loadable driver to build it. 46 | // This ticcmd will then be modified by the gameloop 47 | // for normal input. 48 | ticcmd_t* I_BaseTiccmd (void); 49 | 50 | 51 | // Called by M_Responder when quit is selected. 52 | // Clean exit, displays sell blurb. 53 | void I_Quit (void); 54 | 55 | void I_Error (char *error, ...); 56 | 57 | void I_Tactile (int on, int off, int total); 58 | 59 | boolean I_GetMemoryValue(unsigned int offset, void *value, int size); 60 | 61 | // Schedule a function to be called when the program exits. 62 | // If run_if_error is true, the function is called if the exit 63 | // is due to an error (I_Error) 64 | 65 | void I_AtExit(atexit_func_t func, boolean run_if_error); 66 | 67 | // Add all system-specific config file variable bindings. 68 | 69 | void I_BindVariables(void); 70 | 71 | // Print startup banner copyright message. 72 | 73 | void I_PrintStartupBanner(char *gamedescription); 74 | 75 | // Print a centered text banner displaying the given string. 76 | 77 | void I_PrintBanner(char *text); 78 | 79 | // Print a dividing line for startup banners. 80 | 81 | void I_PrintDivider(void); 82 | 83 | #endif 84 | 85 | -------------------------------------------------------------------------------- /src/chocdoom/m_cheat.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Cheat sequence checking. 17 | // 18 | 19 | 20 | 21 | #include 22 | 23 | #include "doomtype.h" 24 | #include "m_cheat.h" 25 | 26 | // 27 | // CHEAT SEQUENCE PACKAGE 28 | // 29 | 30 | // 31 | // Called in st_stuff module, which handles the input. 32 | // Returns a 1 if the cheat was successful, 0 if failed. 33 | // 34 | int 35 | cht_CheckCheat 36 | ( cheatseq_t* cht, 37 | char key ) 38 | { 39 | // if we make a short sequence on a cheat with parameters, this 40 | // will not work in vanilla doom. behave the same. 41 | 42 | if (cht->parameter_chars > 0 && strlen(cht->sequence) < cht->sequence_len) 43 | return false; 44 | 45 | if (cht->chars_read < strlen(cht->sequence)) 46 | { 47 | // still reading characters from the cheat code 48 | // and verifying. reset back to the beginning 49 | // if a key is wrong 50 | 51 | if (key == cht->sequence[cht->chars_read]) 52 | ++cht->chars_read; 53 | else 54 | cht->chars_read = 0; 55 | 56 | cht->param_chars_read = 0; 57 | } 58 | else if (cht->param_chars_read < cht->parameter_chars) 59 | { 60 | // we have passed the end of the cheat sequence and are 61 | // entering parameters now 62 | 63 | cht->parameter_buf[cht->param_chars_read] = key; 64 | 65 | ++cht->param_chars_read; 66 | } 67 | 68 | if (cht->chars_read >= strlen(cht->sequence) 69 | && cht->param_chars_read >= cht->parameter_chars) 70 | { 71 | cht->chars_read = cht->param_chars_read = 0; 72 | 73 | return true; 74 | } 75 | 76 | // cheat not matched yet 77 | 78 | return false; 79 | } 80 | 81 | void 82 | cht_GetParam 83 | ( cheatseq_t* cht, 84 | char* buffer ) 85 | { 86 | memcpy(buffer, cht->parameter_buf, cht->parameter_chars); 87 | } 88 | 89 | 90 | -------------------------------------------------------------------------------- /src/chocdoom/d_items.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // 17 | 18 | 19 | // We are referring to sprite numbers. 20 | #include "info.h" 21 | 22 | #include "d_items.h" 23 | 24 | 25 | // 26 | // PSPRITE ACTIONS for waepons. 27 | // This struct controls the weapon animations. 28 | // 29 | // Each entry is: 30 | // ammo/amunition type 31 | // upstate 32 | // downstate 33 | // readystate 34 | // atkstate, i.e. attack/fire/hit frame 35 | // flashstate, muzzle flash 36 | // 37 | weaponinfo_t weaponinfo[NUMWEAPONS] = 38 | { 39 | { 40 | // fist 41 | am_noammo, 42 | S_PUNCHUP, 43 | S_PUNCHDOWN, 44 | S_PUNCH, 45 | S_PUNCH1, 46 | S_NULL 47 | }, 48 | { 49 | // pistol 50 | am_clip, 51 | S_PISTOLUP, 52 | S_PISTOLDOWN, 53 | S_PISTOL, 54 | S_PISTOL1, 55 | S_PISTOLFLASH 56 | }, 57 | { 58 | // shotgun 59 | am_shell, 60 | S_SGUNUP, 61 | S_SGUNDOWN, 62 | S_SGUN, 63 | S_SGUN1, 64 | S_SGUNFLASH1 65 | }, 66 | { 67 | // chaingun 68 | am_clip, 69 | S_CHAINUP, 70 | S_CHAINDOWN, 71 | S_CHAIN, 72 | S_CHAIN1, 73 | S_CHAINFLASH1 74 | }, 75 | { 76 | // missile launcher 77 | am_misl, 78 | S_MISSILEUP, 79 | S_MISSILEDOWN, 80 | S_MISSILE, 81 | S_MISSILE1, 82 | S_MISSILEFLASH1 83 | }, 84 | { 85 | // plasma rifle 86 | am_cell, 87 | S_PLASMAUP, 88 | S_PLASMADOWN, 89 | S_PLASMA, 90 | S_PLASMA1, 91 | S_PLASMAFLASH1 92 | }, 93 | { 94 | // bfg 9000 95 | am_cell, 96 | S_BFGUP, 97 | S_BFGDOWN, 98 | S_BFG, 99 | S_BFG1, 100 | S_BFGFLASH1 101 | }, 102 | { 103 | // chainsaw 104 | am_noammo, 105 | S_SAWUP, 106 | S_SAWDOWN, 107 | S_SAW, 108 | S_SAW1, 109 | S_NULL 110 | }, 111 | { 112 | // super shotgun 113 | am_shell, 114 | S_DSGUNUP, 115 | S_DSGUNDOWN, 116 | S_DSGUN, 117 | S_DSGUN1, 118 | S_DSGUNFLASH1 119 | }, 120 | }; 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | -------------------------------------------------------------------------------- /src/chocdoom/w_checksum.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Generate a checksum of the WAD directory. 17 | // 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | #include "m_misc.h" 24 | #include "sha1.h" 25 | #include "w_checksum.h" 26 | #include "w_wad.h" 27 | 28 | static wad_file_t **open_wadfiles = NULL; 29 | static int num_open_wadfiles = 0; 30 | 31 | static int GetFileNumber(wad_file_t *handle) 32 | { 33 | int i; 34 | int result; 35 | 36 | for (i=0; iname, sizeof(buf)); 62 | SHA1_UpdateString(sha1_context, buf); 63 | SHA1_UpdateInt32(sha1_context, GetFileNumber(lump->wad_file)); 64 | SHA1_UpdateInt32(sha1_context, lump->position); 65 | SHA1_UpdateInt32(sha1_context, lump->size); 66 | } 67 | 68 | void W_Checksum(sha1_digest_t digest) 69 | { 70 | sha1_context_t sha1_context; 71 | unsigned int i; 72 | 73 | SHA1_Init(&sha1_context); 74 | 75 | num_open_wadfiles = 0; 76 | 77 | // Go through each entry in the WAD directory, adding information 78 | // about each entry to the SHA1 hash. 79 | 80 | for (i=0; i 14 | #include 15 | #include "stm32f4xx.h" 16 | #include "button.h" 17 | 18 | /*---------------------------------------------------------------------* 19 | * local definitions * 20 | *---------------------------------------------------------------------*/ 21 | 22 | /*---------------------------------------------------------------------* 23 | * external declarations * 24 | *---------------------------------------------------------------------*/ 25 | 26 | /*---------------------------------------------------------------------* 27 | * public data * 28 | *---------------------------------------------------------------------*/ 29 | 30 | /*---------------------------------------------------------------------* 31 | * private data * 32 | *---------------------------------------------------------------------*/ 33 | 34 | /*---------------------------------------------------------------------* 35 | * private functions * 36 | *---------------------------------------------------------------------*/ 37 | 38 | /*---------------------------------------------------------------------* 39 | * public functions * 40 | *---------------------------------------------------------------------*/ 41 | 42 | void button_init (void) 43 | { 44 | GPIO_InitTypeDef GPIO_InitStructure; 45 | 46 | /* enable GPIO clock */ 47 | RCC_AHB1PeriphClockCmd (RCC_AHB1Periph_GPIOA, ENABLE); 48 | 49 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; 50 | GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; 51 | GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; 52 | GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; 53 | GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0; 54 | GPIO_Init (GPIOA, &GPIO_InitStructure); 55 | } 56 | 57 | bool button_read (void) 58 | { 59 | return GPIO_ReadInputDataBit (GPIOA, GPIO_Pin_0); 60 | } 61 | 62 | /*---------------------------------------------------------------------* 63 | * eof * 64 | *---------------------------------------------------------------------*/ 65 | -------------------------------------------------------------------------------- /lib/stm32/system_stm32f4xx.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f4xx.h 4 | * @author MCD Application Team 5 | * @version V1.5.0 6 | * @date 06-March-2015 7 | * @brief CMSIS Cortex-M4 Device System Source File for STM32F4xx devices. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2015 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /** @addtogroup CMSIS 29 | * @{ 30 | */ 31 | 32 | /** @addtogroup stm32f4xx_system 33 | * @{ 34 | */ 35 | 36 | /** 37 | * @brief Define to prevent recursive inclusion 38 | */ 39 | #ifndef __SYSTEM_STM32F4XX_H 40 | #define __SYSTEM_STM32F4XX_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /** @addtogroup STM32F4xx_System_Includes 47 | * @{ 48 | */ 49 | 50 | /** 51 | * @} 52 | */ 53 | 54 | 55 | /** @addtogroup STM32F4xx_System_Exported_types 56 | * @{ 57 | */ 58 | 59 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 60 | 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | /** @addtogroup STM32F4xx_System_Exported_Constants 67 | * @{ 68 | */ 69 | 70 | /** 71 | * @} 72 | */ 73 | 74 | /** @addtogroup STM32F4xx_System_Exported_Macros 75 | * @{ 76 | */ 77 | 78 | /** 79 | * @} 80 | */ 81 | 82 | /** @addtogroup STM32F4xx_System_Exported_Functions 83 | * @{ 84 | */ 85 | 86 | extern void SystemInit(void); 87 | extern void SystemCoreClockUpdate(void); 88 | /** 89 | * @} 90 | */ 91 | 92 | #ifdef __cplusplus 93 | } 94 | #endif 95 | 96 | #endif /*__SYSTEM_STM32F4XX_H */ 97 | 98 | /** 99 | * @} 100 | */ 101 | 102 | /** 103 | * @} 104 | */ 105 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 106 | -------------------------------------------------------------------------------- /src/chocdoom/d_loop.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Main loop stuff. 17 | // 18 | 19 | #ifndef __D_LOOP__ 20 | #define __D_LOOP__ 21 | 22 | #include "net_defs.h" 23 | 24 | // Callback function invoked while waiting for the netgame to start. 25 | // The callback is invoked when new players are ready. The callback 26 | // should return true, or return false to abort startup. 27 | 28 | typedef boolean (*netgame_startup_callback_t)(int ready_players, 29 | int num_players); 30 | 31 | typedef struct 32 | { 33 | // Read events from the event queue, and process them. 34 | 35 | void (*ProcessEvents)(); 36 | 37 | // Given the current input state, fill in the fields of the specified 38 | // ticcmd_t structure with data for a new tic. 39 | 40 | void (*BuildTiccmd)(ticcmd_t *cmd, int maketic); 41 | 42 | // Advance the game forward one tic, using the specified player input. 43 | 44 | void (*RunTic)(ticcmd_t *cmds, boolean *ingame); 45 | 46 | // Run the menu (runs independently of the game). 47 | 48 | void (*RunMenu)(); 49 | } loop_interface_t; 50 | 51 | // Register callback functions for the main loop code to use. 52 | void D_RegisterLoopCallbacks(loop_interface_t *i); 53 | 54 | // Create any new ticcmds and broadcast to other players. 55 | void NetUpdate (void); 56 | 57 | // Broadcasts special packets to other players 58 | // to notify of game exit 59 | void D_QuitNetGame (void); 60 | 61 | //? how many ticks to run? 62 | void TryRunTics (void); 63 | 64 | // Called at start of game loop to initialize timers 65 | void D_StartGameLoop(void); 66 | 67 | // Initialize networking code and connect to server. 68 | 69 | boolean D_InitNetGame(net_connect_data_t *connect_data); 70 | 71 | // Start game with specified settings. The structure will be updated 72 | // with the actual settings for the game. 73 | 74 | void D_StartNetGame(net_gamesettings_t *settings, 75 | netgame_startup_callback_t callback); 76 | 77 | extern boolean singletics; 78 | extern int gametic, ticdup; 79 | 80 | #endif 81 | 82 | -------------------------------------------------------------------------------- /src/chocdoom/r_draw.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // System specific interface stuff. 17 | // 18 | 19 | 20 | #ifndef __R_DRAW__ 21 | #define __R_DRAW__ 22 | 23 | 24 | 25 | 26 | extern lighttable_t* dc_colormap; 27 | extern int dc_x; 28 | extern int dc_yl; 29 | extern int dc_yh; 30 | extern fixed_t dc_iscale; 31 | extern fixed_t dc_texturemid; 32 | 33 | // first pixel in a column 34 | extern byte* dc_source; 35 | 36 | 37 | // The span blitting interface. 38 | // Hook in assembler or system specific BLT 39 | // here. 40 | void R_DrawColumn (void); 41 | void R_DrawColumnLow (void); 42 | 43 | // The Spectre/Invisibility effect. 44 | void R_DrawFuzzColumn (void); 45 | void R_DrawFuzzColumnLow (void); 46 | 47 | // Draw with color translation tables, 48 | // for player sprite rendering, 49 | // Green/Red/Blue/Indigo shirts. 50 | void R_DrawTranslatedColumn (void); 51 | void R_DrawTranslatedColumnLow (void); 52 | 53 | void 54 | R_VideoErase 55 | ( unsigned ofs, 56 | int count ); 57 | 58 | extern int ds_y; 59 | extern int ds_x1; 60 | extern int ds_x2; 61 | 62 | extern lighttable_t* ds_colormap; 63 | 64 | extern fixed_t ds_xfrac; 65 | extern fixed_t ds_yfrac; 66 | extern fixed_t ds_xstep; 67 | extern fixed_t ds_ystep; 68 | 69 | // start of a 64*64 tile image 70 | extern byte* ds_source; 71 | 72 | extern byte* translationtables; 73 | extern byte* dc_translation; 74 | 75 | 76 | // Span blitting for rows, floor/ceiling. 77 | // No Sepctre effect needed. 78 | void R_DrawSpan (void); 79 | 80 | // Low resolution mode, 160x200? 81 | void R_DrawSpanLow (void); 82 | 83 | 84 | void 85 | R_InitBuffer 86 | ( int width, 87 | int height ); 88 | 89 | 90 | // Initialize color translation tables, 91 | // for player rendering etc. 92 | void R_InitTranslationTables (void); 93 | 94 | 95 | 96 | // Rendering function. 97 | void R_FillBackScreen (void); 98 | 99 | // If the view size is not full screen, draws a border around it. 100 | void R_DrawViewBorder (void); 101 | 102 | 103 | 104 | #endif 105 | -------------------------------------------------------------------------------- /src/chocdoom/i_joystick.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 2005-2014 Simon Howard 3 | // 4 | // This program is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License 6 | // as published by the Free Software Foundation; either version 2 7 | // of the License, or (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // DESCRIPTION: 15 | // System-specific joystick interface. 16 | // 17 | 18 | 19 | #ifndef __I_JOYSTICK__ 20 | #define __I_JOYSTICK__ 21 | 22 | // Number of "virtual" joystick buttons defined in configuration files. 23 | // This needs to be at least as large as the number of different key 24 | // bindings supported by the higher-level game code (joyb* variables). 25 | #define NUM_VIRTUAL_BUTTONS 10 26 | 27 | // If this bit is set in a configuration file axis value, the axis is 28 | // not actually a joystick axis, but instead is a "button axis". This 29 | // means that instead of reading an SDL joystick axis, we read the 30 | // state of two buttons to get the axis value. This is needed for eg. 31 | // the PS3 SIXAXIS controller, where the D-pad buttons register as 32 | // buttons, not as two axes. 33 | #define BUTTON_AXIS 0x10000 34 | 35 | // Query whether a given axis value describes a button axis. 36 | #define IS_BUTTON_AXIS(axis) ((axis) >= 0 && ((axis) & BUTTON_AXIS) != 0) 37 | 38 | // Get the individual buttons from a button axis value. 39 | #define BUTTON_AXIS_NEG(axis) ((axis) & 0xff) 40 | #define BUTTON_AXIS_POS(axis) (((axis) >> 8) & 0xff) 41 | 42 | // Create a button axis value from two button values. 43 | #define CREATE_BUTTON_AXIS(neg, pos) (BUTTON_AXIS | (neg) | ((pos) << 8)) 44 | 45 | // If this bit is set in an axis value, the axis is not actually a 46 | // joystick axis, but is a "hat" axis. This means that we read (one of) 47 | // the hats on the joystick. 48 | #define HAT_AXIS 0x20000 49 | 50 | #define IS_HAT_AXIS(axis) ((axis) >= 0 && ((axis) & HAT_AXIS) != 0) 51 | 52 | // Get the hat number from a hat axis value. 53 | #define HAT_AXIS_HAT(axis) ((axis) & 0xff) 54 | // Which axis of the hat? (horizonal or vertical) 55 | #define HAT_AXIS_DIRECTION(axis) (((axis) >> 8) & 0xff) 56 | 57 | #define CREATE_HAT_AXIS(hat, direction) \ 58 | (HAT_AXIS | (hat) | ((direction) << 8)) 59 | 60 | #define HAT_AXIS_HORIZONTAL 1 61 | #define HAT_AXIS_VERTICAL 2 62 | 63 | void I_InitJoystick(void); 64 | void I_ShutdownJoystick(void); 65 | void I_UpdateJoystick(void); 66 | 67 | void I_BindJoystickVariables(void); 68 | 69 | #endif /* #ifndef __I_JOYSTICK__ */ 70 | 71 | -------------------------------------------------------------------------------- /src/chocdoom/tables.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 1993-2008 Raven Software 4 | // Copyright(C) 2005-2014 Simon Howard 5 | // 6 | // This program is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU General Public License 8 | // as published by the Free Software Foundation; either version 2 9 | // of the License, or (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // DESCRIPTION: 17 | // Lookup tables. 18 | // Do not try to look them up :-). 19 | // In the order of appearance: 20 | // 21 | // int finetangent[4096] - Tangens LUT. 22 | // Should work with BAM fairly well (12 of 16bit, 23 | // effectively, by shifting). 24 | // 25 | // int finesine[10240] - Sine lookup. 26 | // Guess what, serves as cosine, too. 27 | // Remarkable thing is, how to use BAMs with this? 28 | // 29 | // int tantoangle[2049] - ArcTan LUT, 30 | // maps tan(angle) to angle fast. Gotta search. 31 | // 32 | 33 | 34 | #ifndef __TABLES__ 35 | #define __TABLES__ 36 | 37 | #include "doomtype.h" 38 | 39 | #include "m_fixed.h" 40 | 41 | #define FINEANGLES 8192 42 | #define FINEMASK (FINEANGLES-1) 43 | 44 | 45 | // 0x100000000 to 0x2000 46 | #define ANGLETOFINESHIFT 19 47 | 48 | // Effective size is 10240. 49 | extern const fixed_t finesine[5*FINEANGLES/4]; 50 | 51 | // Re-use data, is just PI/2 pahse shift. 52 | extern const fixed_t *finecosine; 53 | 54 | 55 | // Effective size is 4096. 56 | extern const fixed_t finetangent[FINEANGLES/2]; 57 | 58 | // Gamma correction tables. 59 | extern const byte gammatable[5][256]; 60 | 61 | // Binary Angle Measument, BAM. 62 | 63 | #define ANG45 0x20000000 64 | #define ANG90 0x40000000 65 | #define ANG180 0x80000000 66 | #define ANG270 0xc0000000 67 | #define ANG_MAX 0xffffffff 68 | 69 | #define ANG1 (ANG45 / 45) 70 | #define ANG60 (ANG180 / 3) 71 | 72 | // Heretic code uses this definition as though it represents one 73 | // degree, but it is not! This is actually ~1.40 degrees. 74 | 75 | #define ANG1_X 0x01000000 76 | 77 | #define SLOPERANGE 2048 78 | #define SLOPEBITS 11 79 | #define DBITS (FRACBITS-SLOPEBITS) 80 | 81 | typedef unsigned angle_t; 82 | 83 | 84 | // Effective size is 2049; 85 | // The +1 size is to handle the case when x==y 86 | // without additional checking. 87 | extern const angle_t tantoangle[SLOPERANGE+1]; 88 | 89 | 90 | // Utility function, 91 | // called by R_PointToAngle. 92 | int SlopeDiv(unsigned int num, unsigned int den); 93 | 94 | 95 | #endif 96 | 97 | -------------------------------------------------------------------------------- /src/chocdoom/doomtype.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Simple basic typedefs, isolated here to make it easier 17 | // separating modules. 18 | // 19 | 20 | 21 | #ifndef __DOOMTYPE__ 22 | #define __DOOMTYPE__ 23 | 24 | // #define macros to provide functions missing in Windows. 25 | // Outside Windows, we use strings.h for str[n]casecmp. 26 | 27 | 28 | #ifdef _WIN32 29 | 30 | #define strcasecmp stricmp 31 | #define strncasecmp strnicmp 32 | 33 | #else 34 | 35 | #include 36 | 37 | #endif 38 | 39 | 40 | // 41 | // The packed attribute forces structures to be packed into the minimum 42 | // space necessary. If this is not done, the compiler may align structure 43 | // fields differently to optimize memory access, inflating the overall 44 | // structure size. It is important to use the packed attribute on certain 45 | // structures where alignment is important, particularly data read/written 46 | // to disk. 47 | // 48 | 49 | #ifdef __GNUC__ 50 | #define PACKEDATTR __attribute__((packed)) 51 | #else 52 | #define PACKEDATTR 53 | #endif 54 | 55 | // C99 integer types; with gcc we just use this. Other compilers 56 | // should add conditional statements that define the C99 types. 57 | 58 | // What is really wanted here is stdint.h; however, some old versions 59 | // of Solaris don't have stdint.h and only have inttypes.h (the 60 | // pre-standardisation version). inttypes.h is also in the C99 61 | // standard and defined to include stdint.h, so include this. 62 | 63 | #include 64 | 65 | #ifdef __cplusplus 66 | 67 | // Use builtin bool type with C++. 68 | 69 | typedef bool boolean; 70 | 71 | #else 72 | 73 | typedef enum 74 | { 75 | false = 0, 76 | true = 1, 77 | undef = 0xFFFFFFFF 78 | } boolean; 79 | 80 | #endif 81 | 82 | typedef uint8_t byte; 83 | 84 | #include 85 | 86 | #ifdef _WIN32 87 | 88 | #define DIR_SEPARATOR '\\' 89 | #define DIR_SEPARATOR_S "\\" 90 | #define PATH_SEPARATOR ';' 91 | 92 | #else 93 | 94 | #define DIR_SEPARATOR '/' 95 | #define DIR_SEPARATOR_S "/" 96 | #define PATH_SEPARATOR ':' 97 | 98 | #endif 99 | 100 | #define arrlen(array) (sizeof(array) / sizeof(*array)) 101 | 102 | #endif 103 | 104 | -------------------------------------------------------------------------------- /lib/usb/usb_bsp.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_bsp.h 4 | * @author MCD Application Team 5 | * @version V2.1.0 6 | * @date 19-March-2012 7 | * @brief Specific api's relative to the used hardware platform 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USB_BSP__H__ 30 | #define __USB_BSP__H__ 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "usb_core.h" 34 | #include "usb_conf.h" 35 | #include "stm32f4xx.h" 36 | 37 | /** @addtogroup USB_OTG_DRIVER 38 | * @{ 39 | */ 40 | 41 | /** @defgroup USB_BSP 42 | * @brief This file is the 43 | * @{ 44 | */ 45 | 46 | 47 | /** @defgroup USB_BSP_Exported_Defines 48 | * @{ 49 | */ 50 | /** 51 | * @} 52 | */ 53 | 54 | 55 | /** @defgroup USB_BSP_Exported_Types 56 | * @{ 57 | */ 58 | /** 59 | * @} 60 | */ 61 | 62 | 63 | /** @defgroup USB_BSP_Exported_Macros 64 | * @{ 65 | */ 66 | /** 67 | * @} 68 | */ 69 | 70 | /** @defgroup USB_BSP_Exported_Variables 71 | * @{ 72 | */ 73 | /** 74 | * @} 75 | */ 76 | 77 | /** @defgroup USB_BSP_Exported_FunctionsPrototype 78 | * @{ 79 | */ 80 | 81 | void USB_OTG_BSP_Init (USB_OTG_CORE_HANDLE *pdev); 82 | void USB_OTG_BSP_uDelay (const uint32_t usec); 83 | void USB_OTG_BSP_mDelay (const uint32_t msec); 84 | void USB_OTG_BSP_EnableInterrupt (USB_OTG_CORE_HANDLE *pdev); 85 | #ifdef USE_HOST_MODE 86 | void USB_OTG_BSP_ConfigVBUS(USB_OTG_CORE_HANDLE *pdev); 87 | void USB_OTG_BSP_DriveVBUS(USB_OTG_CORE_HANDLE *pdev,uint8_t state); 88 | #endif 89 | /** 90 | * @} 91 | */ 92 | 93 | #endif //__USB_BSP__H__ 94 | 95 | /** 96 | * @} 97 | */ 98 | 99 | /** 100 | * @} 101 | */ 102 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 103 | 104 | -------------------------------------------------------------------------------- /lib/usb/usb_conf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * usb_conf.h 3 | * 4 | * Created on: 21.03.2015 5 | * Author: Florian 6 | */ 7 | 8 | 9 | #ifndef LIB_USB_USB_CONF_H_ 10 | #define LIB_USB_USB_CONF_H_ 11 | 12 | /*---------------------------------------------------------------------* 13 | * additional includes * 14 | *---------------------------------------------------------------------*/ 15 | 16 | #include "stm32f4xx.h" 17 | 18 | /*---------------------------------------------------------------------* 19 | * global definitions * 20 | *---------------------------------------------------------------------*/ 21 | 22 | #define RX_FIFO_HS_SIZE 512 23 | #define TXH_NP_HS_FIFOSIZ 256 24 | #define TXH_P_HS_FIFOSIZ 256 25 | 26 | #define USB_OTG_HS_INTERNAL_DMA_ENABLED 27 | #define USE_USB_OTG_HS 28 | #define USB_OTG_EMBEDDED_PHY_ENABLED 29 | #define USB_OTG_EXTERNAL_VBUS_ENABLED 30 | #define USB_OTG_HS_CORE 31 | #define USB_HOST_MODE 32 | #define USE_HOST_MODE 33 | #undef USB_SUPPORT_USER_STRING_DESC 34 | #undef USE_USB_OTG_FS 35 | #undef USB_OTG_ULPI_PHY_ENABLED 36 | #undef USE_DEVICE_MODE 37 | #undef DUAL_ROLE_MODE_ENABLED 38 | #undef USE_OTG_MODE 39 | #undef USB_OTG_FS_CORE 40 | #undef VBUS_SENSING_ENABLED 41 | #undef USB_OTG_HS_SOF_OUTPUT_ENABLED 42 | #undef USB_OTG_HS_LOW_PWR_MGMT_SUPPORT 43 | #undef USB_OTG_INTERNAL_VBUS_ENABLED 44 | 45 | #ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED 46 | #define __ALIGN_END __attribute__ ((aligned (4))) 47 | #define __ALIGN_BEGIN 48 | #else 49 | #define __ALIGN_BEGIN 50 | #define __ALIGN_END 51 | #endif 52 | 53 | #ifndef __packed 54 | #define __packed __attribute__ ((__packed__)) 55 | #endif 56 | 57 | /*---------------------------------------------------------------------* 58 | * type declarations * 59 | *---------------------------------------------------------------------*/ 60 | 61 | /*---------------------------------------------------------------------* 62 | * function prototypes * 63 | *---------------------------------------------------------------------*/ 64 | 65 | /*---------------------------------------------------------------------* 66 | * global data * 67 | *---------------------------------------------------------------------*/ 68 | 69 | /*---------------------------------------------------------------------* 70 | * inline functions and function-like macros * 71 | *---------------------------------------------------------------------*/ 72 | 73 | /*---------------------------------------------------------------------* 74 | * eof * 75 | *---------------------------------------------------------------------*/ 76 | 77 | #endif /* LIB_USB_USB_CONF_H_ */ 78 | -------------------------------------------------------------------------------- /src/chocdoom/m_random.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Random number LUT. 17 | // 18 | 19 | #if ORIGCODE 20 | #include 21 | #endif 22 | 23 | #include "m_random.h" 24 | 25 | #include "main.h" 26 | 27 | // 28 | // M_Random 29 | // Returns a 0-255 number 30 | // 31 | 32 | static const unsigned char rndtable[256] = { 33 | 0, 8, 109, 220, 222, 241, 149, 107, 75, 248, 254, 140, 16, 66 , 34 | 74, 21, 211, 47, 80, 242, 154, 27, 205, 128, 161, 89, 77, 36 , 35 | 95, 110, 85, 48, 212, 140, 211, 249, 22, 79, 200, 50, 28, 188 , 36 | 52, 140, 202, 120, 68, 145, 62, 70, 184, 190, 91, 197, 152, 224 , 37 | 149, 104, 25, 178, 252, 182, 202, 182, 141, 197, 4, 81, 181, 242 , 38 | 145, 42, 39, 227, 156, 198, 225, 193, 219, 93, 122, 175, 249, 0 , 39 | 175, 143, 70, 239, 46, 246, 163, 53, 163, 109, 168, 135, 2, 235 , 40 | 25, 92, 20, 145, 138, 77, 69, 166, 78, 176, 173, 212, 166, 113 , 41 | 94, 161, 41, 50, 239, 49, 111, 164, 70, 60, 2, 37, 171, 75 , 42 | 136, 156, 11, 56, 42, 146, 138, 229, 73, 146, 77, 61, 98, 196 , 43 | 135, 106, 63, 197, 195, 86, 96, 203, 113, 101, 170, 247, 181, 113 , 44 | 80, 250, 108, 7, 255, 237, 129, 226, 79, 107, 112, 166, 103, 241 , 45 | 24, 223, 239, 120, 198, 58, 60, 82, 128, 3, 184, 66, 143, 224 , 46 | 145, 224, 81, 206, 163, 45, 63, 90, 168, 114, 59, 33, 159, 95 , 47 | 28, 139, 123, 98, 125, 196, 15, 70, 194, 253, 54, 14, 109, 226 , 48 | 71, 17, 161, 93, 186, 87, 244, 138, 20, 52, 123, 251, 26, 36 , 49 | 17, 46, 52, 231, 232, 76, 31, 221, 84, 37, 216, 165, 212, 106 , 50 | 197, 242, 98, 43, 39, 175, 254, 145, 190, 84, 118, 222, 187, 136 , 51 | 120, 163, 236, 249 52 | }; 53 | 54 | int rndindex = 0; 55 | int prndindex = 0; 56 | 57 | // Which one is deterministic? 58 | int P_Random (void) 59 | { 60 | prndindex = (prndindex+1)&0xff; 61 | return rndtable[prndindex]; 62 | } 63 | 64 | int M_Random (void) 65 | { 66 | rndindex = (rndindex+1)&0xff; 67 | return rndtable[rndindex]; 68 | } 69 | 70 | void M_ClearRandom (void) 71 | { 72 | prndindex = 0; 73 | 74 | // Seed the M_Random counter from the system time 75 | #if ORIGCODE 76 | rndindex = time(NULL) & 0xff; 77 | #else 78 | rndindex = systime & 0xff; 79 | #endif 80 | } 81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /src/chocdoom/i_timer.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Timer functions. 17 | // 18 | 19 | #ifdef ORIGCODE 20 | #include "SDL.h" 21 | #endif 22 | 23 | #include "i_timer.h" 24 | #include "doomtype.h" 25 | 26 | #include "main.h" 27 | 28 | #ifdef ORIGCODE 29 | 30 | // 31 | // I_GetTime 32 | // returns time in 1/35th second tics 33 | // 34 | 35 | static Uint32 basetime = 0; 36 | 37 | int I_GetTime (void) 38 | { 39 | Uint32 ticks; 40 | 41 | ticks = SDL_GetTicks(); 42 | 43 | if (basetime == 0) 44 | basetime = ticks; 45 | 46 | ticks -= basetime; 47 | 48 | return (ticks * TICRATE) / 1000; 49 | } 50 | 51 | // 52 | // Same as I_GetTime, but returns time in milliseconds 53 | // 54 | 55 | int I_GetTimeMS(void) 56 | { 57 | Uint32 ticks; 58 | 59 | ticks = SDL_GetTicks(); 60 | 61 | if (basetime == 0) 62 | basetime = ticks; 63 | 64 | return ticks - basetime; 65 | } 66 | 67 | // Sleep for a specified number of ms 68 | 69 | void I_Sleep(int ms) 70 | { 71 | SDL_Delay(ms); 72 | } 73 | 74 | void I_WaitVBL(int count) 75 | { 76 | I_Sleep((count * 1000) / 70); 77 | } 78 | 79 | 80 | void I_InitTimer(void) 81 | { 82 | // initialize timer 83 | 84 | SDL_Init(SDL_INIT_TIMER); 85 | } 86 | 87 | #else 88 | 89 | // 90 | // I_GetTime 91 | // returns time in 1/35th second tics 92 | // 93 | 94 | static uint32_t basetime = 0; 95 | 96 | int I_GetTime (void) 97 | { 98 | uint32_t ticks; 99 | 100 | ticks = systime; 101 | 102 | if (basetime == 0) 103 | basetime = ticks; 104 | 105 | ticks -= basetime; 106 | 107 | return (ticks * TICRATE) / 1000; 108 | } 109 | 110 | // 111 | // Same as I_GetTime, but returns time in milliseconds 112 | // 113 | 114 | int I_GetTimeMS(void) 115 | { 116 | uint32_t ticks; 117 | 118 | ticks = systime; 119 | 120 | if (basetime == 0) 121 | basetime = ticks; 122 | 123 | return ticks - basetime; 124 | } 125 | 126 | // Sleep for a specified number of ms 127 | 128 | void I_Sleep(int ms) 129 | { 130 | sleep_ms (ms); 131 | } 132 | 133 | void I_WaitVBL(int count) 134 | { 135 | I_Sleep((count * 1000) / 70); 136 | } 137 | 138 | 139 | void I_InitTimer(void) 140 | { 141 | // initialize timer 142 | } 143 | 144 | #endif 145 | 146 | -------------------------------------------------------------------------------- /lib/fatfs/diskio.h: -------------------------------------------------------------------------------- 1 | /*-----------------------------------------------------------------------/ 2 | / Low level disk interface modlue include file (C)ChaN, 2014 / 3 | /-----------------------------------------------------------------------*/ 4 | 5 | #ifndef _DISKIO_DEFINED 6 | #define _DISKIO_DEFINED 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | #define _USE_WRITE 1 /* 1: Enable disk_write function */ 13 | #define _USE_IOCTL 1 /* 1: Enable disk_ioctl function */ 14 | 15 | #include "integer.h" 16 | 17 | /* Available disks */ 18 | typedef enum 19 | { 20 | DISK_USB = 0, 21 | DISK_SDCARD = 1, 22 | } diskio_media_t; 23 | 24 | 25 | /* Status of Disk Functions */ 26 | typedef BYTE DSTATUS; 27 | 28 | /* Results of Disk Functions */ 29 | typedef enum { 30 | RES_OK = 0, /* 0: Successful */ 31 | RES_ERROR, /* 1: R/W Error */ 32 | RES_WRPRT, /* 2: Write Protected */ 33 | RES_NOTRDY, /* 3: Not Ready */ 34 | RES_PARERR /* 4: Invalid Parameter */ 35 | } DRESULT; 36 | 37 | 38 | /*---------------------------------------*/ 39 | /* Prototypes for disk control functions */ 40 | 41 | 42 | DSTATUS disk_initialize (BYTE pdrv); 43 | DSTATUS disk_status (BYTE pdrv); 44 | DRESULT disk_read (BYTE pdrv, BYTE* buff, DWORD sector, UINT count); 45 | DRESULT disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, UINT count); 46 | DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff); 47 | 48 | 49 | /* Disk Status Bits (DSTATUS) */ 50 | 51 | #define STA_NOINIT 0x01 /* Drive not initialized */ 52 | #define STA_NODISK 0x02 /* No medium in the drive */ 53 | #define STA_PROTECT 0x04 /* Write protected */ 54 | 55 | 56 | /* Command code for disk_ioctrl function */ 57 | 58 | /* Generic command (Used by FatFs) */ 59 | #define CTRL_SYNC 0 /* Complete pending write process (needed at _FS_READONLY == 0) */ 60 | #define GET_SECTOR_COUNT 1 /* Get media size (needed at _USE_MKFS == 1) */ 61 | #define GET_SECTOR_SIZE 2 /* Get sector size (needed at _MAX_SS != _MIN_SS) */ 62 | #define GET_BLOCK_SIZE 3 /* Get erase block size (needed at _USE_MKFS == 1) */ 63 | #define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at _USE_TRIM == 1) */ 64 | 65 | /* Generic command (Not used by FatFs) */ 66 | #define CTRL_POWER 5 /* Get/Set power status */ 67 | #define CTRL_LOCK 6 /* Lock/Unlock media removal */ 68 | #define CTRL_EJECT 7 /* Eject media */ 69 | #define CTRL_FORMAT 8 /* Create physical format on the media */ 70 | 71 | /* MMC/SDC specific ioctl command */ 72 | #define MMC_GET_TYPE 10 /* Get card type */ 73 | #define MMC_GET_CSD 11 /* Get CSD */ 74 | #define MMC_GET_CID 12 /* Get CID */ 75 | #define MMC_GET_OCR 13 /* Get OCR */ 76 | #define MMC_GET_SDSTAT 14 /* Get SD status */ 77 | 78 | /* ATA/CF specific ioctl command */ 79 | #define ATA_GET_REV 20 /* Get F/W revision */ 80 | #define ATA_GET_MODEL 21 /* Get model name */ 81 | #define ATA_GET_SN 22 /* Get serial number */ 82 | 83 | #ifdef __cplusplus 84 | } 85 | #endif 86 | 87 | #endif 88 | -------------------------------------------------------------------------------- /src/chocdoom/doomkeys.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Key definitions 17 | // 18 | 19 | #ifndef __DOOMKEYS__ 20 | #define __DOOMKEYS__ 21 | 22 | // 23 | // DOOM keyboard definition. 24 | // This is the stuff configured by Setup.Exe. 25 | // Most key data are simple ascii (uppercased). 26 | // 27 | #define KEY_RIGHTARROW 0xae 28 | #define KEY_LEFTARROW 0xac 29 | #define KEY_UPARROW 0xad 30 | #define KEY_DOWNARROW 0xaf 31 | #define KEY_STRAFE_L 0xa0 32 | #define KEY_STRAFE_R 0xa1 33 | #define KEY_USE 0xa2 34 | #define KEY_FIRE 0xa3 35 | #define KEY_ESCAPE 27 36 | #define KEY_ENTER 13 37 | #define KEY_TAB 9 38 | #define KEY_F1 (0x80+0x3b) 39 | #define KEY_F2 (0x80+0x3c) 40 | #define KEY_F3 (0x80+0x3d) 41 | #define KEY_F4 (0x80+0x3e) 42 | #define KEY_F5 (0x80+0x3f) 43 | #define KEY_F6 (0x80+0x40) 44 | #define KEY_F7 (0x80+0x41) 45 | #define KEY_F8 (0x80+0x42) 46 | #define KEY_F9 (0x80+0x43) 47 | #define KEY_F10 (0x80+0x44) 48 | #define KEY_F11 (0x80+0x57) 49 | #define KEY_F12 (0x80+0x58) 50 | 51 | #define KEY_BACKSPACE 0x7f 52 | #define KEY_PAUSE 0xff 53 | 54 | #define KEY_EQUALS 0x3d 55 | #define KEY_MINUS 0x2d 56 | 57 | #define KEY_RSHIFT (0x80+0x36) 58 | #define KEY_RCTRL (0x80+0x1d) 59 | #define KEY_RALT (0x80+0x38) 60 | 61 | #define KEY_LALT KEY_RALT 62 | 63 | // new keys: 64 | 65 | #define KEY_CAPSLOCK (0x80+0x3a) 66 | #define KEY_NUMLOCK (0x80+0x45) 67 | #define KEY_SCRLCK (0x80+0x46) 68 | #define KEY_PRTSCR (0x80+0x59) 69 | 70 | #define KEY_HOME (0x80+0x47) 71 | #define KEY_END (0x80+0x4f) 72 | #define KEY_PGUP (0x80+0x49) 73 | #define KEY_PGDN (0x80+0x51) 74 | #define KEY_INS (0x80+0x52) 75 | #define KEY_DEL (0x80+0x53) 76 | 77 | #define KEYP_0 0 78 | #define KEYP_1 KEY_END 79 | #define KEYP_2 KEY_DOWNARROW 80 | #define KEYP_3 KEY_PGDN 81 | #define KEYP_4 KEY_LEFTARROW 82 | #define KEYP_5 '5' 83 | #define KEYP_6 KEY_RIGHTARROW 84 | #define KEYP_7 KEY_HOME 85 | #define KEYP_8 KEY_UPARROW 86 | #define KEYP_9 KEY_PGUP 87 | 88 | #define KEYP_DIVIDE '/' 89 | #define KEYP_PLUS '+' 90 | #define KEYP_MINUS '-' 91 | #define KEYP_MULTIPLY '*' 92 | #define KEYP_PERIOD 0 93 | #define KEYP_EQUALS KEY_EQUALS 94 | #define KEYP_ENTER KEY_ENTER 95 | 96 | #endif // __DOOMKEYS__ 97 | 98 | -------------------------------------------------------------------------------- /lib/usb/usbh_usr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * usbh_usr.h 3 | * 4 | * Created on: 21.03.2015 5 | * Author: Florian 6 | */ 7 | 8 | 9 | #ifndef LIB_USB_USBH_USR_H_ 10 | #define LIB_USB_USBH_USR_H_ 11 | 12 | /*---------------------------------------------------------------------* 13 | * additional includes * 14 | *---------------------------------------------------------------------*/ 15 | 16 | #include 17 | #include "usbh_core.h" 18 | #include "usbh_msc_core.h" 19 | 20 | /*---------------------------------------------------------------------* 21 | * global definitions * 22 | *---------------------------------------------------------------------*/ 23 | 24 | #define BUFFER_SIZE ((uint16_t)512*64) 25 | #define USH_USR_FS_INIT ((uint8_t)0x00) 26 | #define USH_USR_FS_LOOP ((uint8_t)0x01) 27 | 28 | /*---------------------------------------------------------------------* 29 | * type declarations * 30 | *---------------------------------------------------------------------*/ 31 | 32 | /*---------------------------------------------------------------------* 33 | * function prototypes * 34 | *---------------------------------------------------------------------*/ 35 | 36 | void USBH_USR_Init (void); 37 | void USBH_USR_DeviceAttached (void); 38 | void USBH_USR_ResetDevice (void); 39 | void USBH_USR_DeviceDisconnected (void); 40 | void USBH_USR_OverCurrentDetected (void); 41 | void USBH_USR_DeviceSpeedDetected (uint8_t DeviceSpeed); 42 | void USBH_USR_Device_DescAvailable (void*); 43 | void USBH_USR_DeviceAddressAssigned (void); 44 | void USBH_USR_Configuration_DescAvailable (USBH_CfgDesc_TypeDef* cfgDesc, USBH_InterfaceDesc_TypeDef* itfDesc, USBH_EpDesc_TypeDef* epDesc); 45 | void USBH_USR_Manufacturer_String (void*); 46 | void USBH_USR_Product_String (void*); 47 | void USBH_USR_SerialNum_String (void*); 48 | void USBH_USR_EnumerationDone (void); 49 | USBH_USR_Status USBH_USR_UserInput (void); 50 | int USBH_USR_MSC_Application (void); 51 | void USBH_USR_DeInit (void); 52 | void USBH_USR_DeviceNotSupported (void); 53 | void USBH_USR_UnrecoveredError (void); 54 | 55 | /*---------------------------------------------------------------------* 56 | * global data * 57 | *---------------------------------------------------------------------*/ 58 | 59 | extern USBH_Usr_cb_TypeDef USR_Callbacks; 60 | 61 | /*---------------------------------------------------------------------* 62 | * inline functions and function-like macros * 63 | *---------------------------------------------------------------------*/ 64 | 65 | /*---------------------------------------------------------------------* 66 | * eof * 67 | *---------------------------------------------------------------------*/ 68 | 69 | #endif /* LIB_USB_USBH_USR_H_ */ 70 | -------------------------------------------------------------------------------- /src/chocdoom/r_state.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Refresh/render internal state variables (global). 17 | // 18 | 19 | 20 | #ifndef __R_STATE__ 21 | #define __R_STATE__ 22 | 23 | // Need data structure definitions. 24 | #include "d_player.h" 25 | #include "r_data.h" 26 | 27 | 28 | 29 | 30 | 31 | 32 | // 33 | // Refresh internal data structures, 34 | // for rendering. 35 | // 36 | 37 | // needed for texture pegging 38 | extern fixed_t* textureheight; 39 | 40 | // needed for pre rendering (fracs) 41 | extern fixed_t* spritewidth; 42 | 43 | extern fixed_t* spriteoffset; 44 | extern fixed_t* spritetopoffset; 45 | 46 | extern lighttable_t* colormaps; 47 | 48 | extern int viewwidth; 49 | extern int scaledviewwidth; 50 | extern int viewheight; 51 | 52 | extern int firstflat; 53 | 54 | // for global animation 55 | extern int* flattranslation; 56 | extern int* texturetranslation; 57 | 58 | 59 | // Sprite.... 60 | extern int firstspritelump; 61 | extern int lastspritelump; 62 | extern int numspritelumps; 63 | 64 | 65 | 66 | // 67 | // Lookup tables for map data. 68 | // 69 | extern int numsprites; 70 | extern spritedef_t* sprites; 71 | 72 | extern int numvertexes; 73 | extern vertex_t* vertexes; 74 | 75 | extern int numsegs; 76 | extern seg_t* segs; 77 | 78 | extern int numsectors; 79 | extern sector_t* sectors; 80 | 81 | extern int numsubsectors; 82 | extern subsector_t* subsectors; 83 | 84 | extern int numnodes; 85 | extern node_t* nodes; 86 | 87 | extern int numlines; 88 | extern line_t* lines; 89 | 90 | extern int numsides; 91 | extern side_t* sides; 92 | 93 | 94 | // 95 | // POV data. 96 | // 97 | extern fixed_t viewx; 98 | extern fixed_t viewy; 99 | extern fixed_t viewz; 100 | 101 | extern angle_t viewangle; 102 | extern player_t* viewplayer; 103 | 104 | 105 | // ? 106 | extern angle_t clipangle; 107 | 108 | extern int viewangletox[FINEANGLES/2]; 109 | extern angle_t xtoviewangle[SCREENWIDTH+1]; 110 | //extern fixed_t finetangent[FINEANGLES/2]; 111 | 112 | extern fixed_t rw_distance; 113 | extern angle_t rw_normalangle; 114 | 115 | 116 | 117 | // angle to line origin 118 | extern int rw_angle1; 119 | 120 | // Segs count? 121 | extern int sscount; 122 | 123 | extern visplane_t* floorplane; 124 | extern visplane_t* ceilingplane; 125 | 126 | 127 | #endif 128 | -------------------------------------------------------------------------------- /src/led.c: -------------------------------------------------------------------------------- 1 | /* 2 | * led.c 3 | * 4 | * Created on: 16.05.2014 5 | * Author: Florian 6 | */ 7 | 8 | 9 | /*---------------------------------------------------------------------* 10 | * include files * 11 | *---------------------------------------------------------------------*/ 12 | 13 | #include 14 | #include "stm32f4xx.h" 15 | #include "led.h" 16 | 17 | /*---------------------------------------------------------------------* 18 | * local definitions * 19 | *---------------------------------------------------------------------*/ 20 | 21 | /*---------------------------------------------------------------------* 22 | * external declarations * 23 | *---------------------------------------------------------------------*/ 24 | 25 | /*---------------------------------------------------------------------* 26 | * public data * 27 | *---------------------------------------------------------------------*/ 28 | 29 | /*---------------------------------------------------------------------* 30 | * private data * 31 | *---------------------------------------------------------------------*/ 32 | 33 | /*---------------------------------------------------------------------* 34 | * private functions * 35 | *---------------------------------------------------------------------*/ 36 | 37 | /*---------------------------------------------------------------------* 38 | * public functions * 39 | *---------------------------------------------------------------------*/ 40 | 41 | void led_init (void) 42 | { 43 | GPIO_InitTypeDef GPIO_InitStructure; 44 | 45 | /* enable GPIO clock */ 46 | RCC_AHB1PeriphClockCmd (RCC_AHB1Periph_GPIOG, ENABLE); 47 | 48 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; 49 | GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; 50 | GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; 51 | GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; 52 | GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13; 53 | GPIO_Init (GPIOG, &GPIO_InitStructure); 54 | } 55 | 56 | void led_set (led_t led, led_state_t led_state) 57 | { 58 | uint16_t pin; 59 | 60 | switch (led) 61 | { 62 | case LED_GREEN: 63 | pin = GPIO_Pin_13; 64 | break; 65 | 66 | case LED_RED: 67 | pin = GPIO_Pin_14; 68 | return; 69 | 70 | default: 71 | return; 72 | } 73 | 74 | switch (led_state) 75 | { 76 | case LED_STATE_ON: 77 | GPIO_SetBits (GPIOG, pin); 78 | break; 79 | 80 | case LED_STATE_OFF: 81 | GPIO_ResetBits (GPIOG, pin); 82 | break; 83 | 84 | default: 85 | return; 86 | } 87 | } 88 | 89 | /*---------------------------------------------------------------------* 90 | * eof * 91 | *---------------------------------------------------------------------*/ 92 | -------------------------------------------------------------------------------- /src/chocdoom/config.h: -------------------------------------------------------------------------------- 1 | /* config.hin. Generated from configure.ac by autoheader. */ 2 | 3 | /* Define to 1 if you have the header file. */ 4 | #undef HAVE_DEV_ISA_SPKRIO_H 5 | 6 | /* Define to 1 if you have the header file. */ 7 | #undef HAVE_DEV_SPEAKER_SPEAKER_H 8 | 9 | /* Define to 1 if you have the header file. */ 10 | #define HAVE_INTTYPES_H 1 11 | 12 | /* Define to 1 if you have the `ioperm' function. */ 13 | #undef HAVE_IOPERM 14 | 15 | /* Define to 1 if you have the `amd64' library (-lamd64). */ 16 | #undef HAVE_LIBAMD64 17 | 18 | /* Define to 1 if you have the `i386' library (-li386). */ 19 | #undef HAVE_LIBI386 20 | 21 | /* Define to 1 if you have the `m' library (-lm). */ 22 | #undef HAVE_LIBM 23 | 24 | /* Define to 1 if you have the `png' library (-lpng). */ 25 | #undef HAVE_LIBPNG 26 | 27 | /* Define to 1 if you have the `samplerate' library (-lsamplerate). */ 28 | #undef HAVE_LIBSAMPLERATE 29 | 30 | /* Define to 1 if you have the `z' library (-lz). */ 31 | #undef HAVE_LIBZ 32 | 33 | /* Define to 1 if you have the header file. */ 34 | #undef HAVE_LINUX_KD_H 35 | 36 | /* Define to 1 if you have the header file. */ 37 | #undef HAVE_MEMORY_H 38 | 39 | /* Define to 1 if you have the `mmap' function. */ 40 | #undef HAVE_MMAP 41 | 42 | /* Define to 1 if you have the `sched_setaffinity' function. */ 43 | #undef HAVE_SCHED_SETAFFINITY 44 | 45 | /* Define to 1 if you have the header file. */ 46 | #define HAVE_STDINT_H 1 47 | 48 | /* Define to 1 if you have the header file. */ 49 | #define HAVE_STDLIB_H 1 50 | 51 | /* Define to 1 if you have the header file. */ 52 | #define HAVE_STRINGS_H 1 53 | 54 | /* Define to 1 if you have the header file. */ 55 | #define HAVE_STRING_H 1 56 | 57 | /* Define to 1 if you have the header file. */ 58 | #undef HAVE_SYS_STAT_H 59 | 60 | /* Define to 1 if you have the header file. */ 61 | #define HAVE_SYS_TYPES_H 1 62 | 63 | /* Define to 1 if you have the header file. */ 64 | #undef HAVE_UNISTD_H 65 | 66 | /* Name of package */ 67 | #define PACKAGE "Doom" 68 | 69 | /* Define to the address where bug reports for this package should be sent. */ 70 | #undef PACKAGE_BUGREPORT 71 | 72 | /* Define to the full name of this package. */ 73 | #define PACKAGE_NAME "STM32Doom" 74 | 75 | /* Define to the full name and version of this package. */ 76 | #define PACKAGE_STRING "STM32Doom 0.1" 77 | 78 | /* Define to the one symbol short name of this package. */ 79 | #define PACKAGE_TARNAME "stm32doom.tar" 80 | 81 | /* Define to the home page for this package. */ 82 | #define PACKAGE_URL "" 83 | 84 | /* Define to the version of this package. */ 85 | #define PACKAGE_VERSION 0.1 86 | 87 | /* Change this when you create your awesome forked version */ 88 | #define PROGRAM_PREFIX "stm32doom" 89 | 90 | /* Define to 1 if you have the ANSI C header files. */ 91 | #define STDC_HEADERS 1 92 | 93 | /* Version number of package */ 94 | #define VERSION 0.1 95 | 96 | /* Define to 1 if you want to compile the unmodified code */ 97 | #undef ORIGCODE 98 | 99 | /* Define to the directory where all game files are located */ 100 | #define FILES_DIR "0:/doom" -------------------------------------------------------------------------------- /src/chocdoom/d_mode.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(C) 1993-1996 Id Software, Inc. 3 | // Copyright(C) 2005-2014 Simon Howard 4 | // 5 | // This program is free software; you can redistribute it and/or 6 | // modify it under the terms of the GNU General Public License 7 | // as published by the Free Software Foundation; either version 2 8 | // of the License, or (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // DESCRIPTION: 16 | // Functions and definitions relating to the game type and operational 17 | // mode. 18 | // 19 | 20 | #ifndef __D_MODE__ 21 | #define __D_MODE__ 22 | 23 | #include "doomtype.h" 24 | 25 | // The "mission" controls what game we are playing. 26 | 27 | typedef enum 28 | { 29 | doom, // Doom 1 30 | doom2, // Doom 2 31 | pack_tnt, // Final Doom: TNT: Evilution 32 | pack_plut, // Final Doom: The Plutonia Experiment 33 | pack_chex, // Chex Quest (modded doom) 34 | pack_hacx, // Hacx (modded doom2) 35 | heretic, // Heretic 36 | hexen, // Hexen 37 | strife, // Strife 38 | 39 | none 40 | } GameMission_t; 41 | 42 | // The "mode" allows more accurate specification of the game mode we are 43 | // in: eg. shareware vs. registered. So doom1.wad and doom.wad are the 44 | // same mission, but a different mode. 45 | 46 | typedef enum 47 | { 48 | shareware, // Doom/Heretic shareware 49 | registered, // Doom/Heretic registered 50 | commercial, // Doom II/Hexen 51 | retail, // Ultimate Doom 52 | indetermined // Unknown. 53 | } GameMode_t; 54 | 55 | // What version are we emulating? 56 | 57 | typedef enum 58 | { 59 | exe_doom_1_2, // Doom 1.2: shareware and registered 60 | exe_doom_1_666, // Doom 1.666: for shareware, registered and commercial 61 | exe_doom_1_7, // Doom 1.7/1.7a: " 62 | exe_doom_1_8, // Doom 1.8: " 63 | exe_doom_1_9, // Doom 1.9: " 64 | exe_hacx, // Hacx 65 | exe_ultimate, // Ultimate Doom (retail) 66 | exe_final, // Final Doom 67 | exe_final2, // Final Doom (alternate exe) 68 | exe_chex, // Chex Quest executable (based on Final Doom) 69 | 70 | exe_heretic_1_3, // Heretic 1.3 71 | 72 | exe_hexen_1_1, // Hexen 1.1 73 | exe_strife_1_2, // Strife v1.2 74 | exe_strife_1_31 // Strife v1.31 75 | } GameVersion_t; 76 | 77 | // Skill level. 78 | 79 | typedef enum 80 | { 81 | sk_noitems = -1, // the "-skill 0" hack 82 | sk_baby = 0, 83 | sk_easy, 84 | sk_medium, 85 | sk_hard, 86 | sk_nightmare 87 | } skill_t; 88 | 89 | boolean D_ValidGameMode(GameMission_t mission, GameMode_t mode); 90 | boolean D_ValidGameVersion(GameMission_t mission, GameVersion_t version); 91 | boolean D_ValidEpisodeMap(GameMission_t mission, GameMode_t mode, 92 | int episode, int map); 93 | int D_GetNumEpisodes(GameMission_t mission, GameMode_t mode); 94 | boolean D_IsEpisodeMap(GameMission_t mission); 95 | char *D_GameMissionString(GameMission_t mission); 96 | 97 | #endif /* #ifndef __D_MODE__ */ 98 | 99 | -------------------------------------------------------------------------------- /lib/usb/usb_hcd.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_hcd.h 4 | * @author MCD Application Team 5 | * @version V2.1.0 6 | * @date 19-March-2012 7 | * @brief Host layer Header file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USB_HCD_H__ 30 | #define __USB_HCD_H__ 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "usb_regs.h" 34 | #include "usb_core.h" 35 | 36 | 37 | /** @addtogroup USB_OTG_DRIVER 38 | * @{ 39 | */ 40 | 41 | /** @defgroup USB_HCD 42 | * @brief This file is the 43 | * @{ 44 | */ 45 | 46 | 47 | /** @defgroup USB_HCD_Exported_Defines 48 | * @{ 49 | */ 50 | /** 51 | * @} 52 | */ 53 | 54 | 55 | /** @defgroup USB_HCD_Exported_Types 56 | * @{ 57 | */ 58 | /** 59 | * @} 60 | */ 61 | 62 | 63 | /** @defgroup USB_HCD_Exported_Macros 64 | * @{ 65 | */ 66 | /** 67 | * @} 68 | */ 69 | 70 | /** @defgroup USB_HCD_Exported_Variables 71 | * @{ 72 | */ 73 | /** 74 | * @} 75 | */ 76 | 77 | /** @defgroup USB_HCD_Exported_FunctionsPrototype 78 | * @{ 79 | */ 80 | uint32_t HCD_Init (USB_OTG_CORE_HANDLE *pdev , 81 | USB_OTG_CORE_ID_TypeDef coreID); 82 | uint32_t HCD_HC_Init (USB_OTG_CORE_HANDLE *pdev , 83 | uint8_t hc_num); 84 | uint32_t HCD_SubmitRequest (USB_OTG_CORE_HANDLE *pdev , 85 | uint8_t hc_num) ; 86 | uint32_t HCD_GetCurrentSpeed (USB_OTG_CORE_HANDLE *pdev); 87 | uint32_t HCD_ResetPort (USB_OTG_CORE_HANDLE *pdev); 88 | uint32_t HCD_IsDeviceConnected (USB_OTG_CORE_HANDLE *pdev); 89 | uint32_t HCD_GetCurrentFrame (USB_OTG_CORE_HANDLE *pdev) ; 90 | URB_STATE HCD_GetURB_State (USB_OTG_CORE_HANDLE *pdev, uint8_t ch_num); 91 | uint32_t HCD_GetXferCnt (USB_OTG_CORE_HANDLE *pdev, uint8_t ch_num); 92 | HC_STATUS HCD_GetHCState (USB_OTG_CORE_HANDLE *pdev, uint8_t ch_num) ; 93 | /** 94 | * @} 95 | */ 96 | 97 | #endif //__USB_HCD_H__ 98 | 99 | 100 | /** 101 | * @} 102 | */ 103 | 104 | /** 105 | * @} 106 | */ 107 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 108 | 109 | --------------------------------------------------------------------------------