Stephane-D/SGDK

GitHub: Stephane-D/SGDK

SGDK 是一个免费开源的 Sega Mega Drive 开发套件,使用 C 语言为该平台开发游戏和软件。

Stars: 2142 | Forks: 223

# SGDK 2.11(2025年4月) #### 版权所有 2025 Stephane Dallongeville Github: https://github.com/Stephane-D/SGDK
Patreon: https://www.patreon.com/SGDK **SGDK** 是一个免费的开发套件,允许使用 **C 语言** 为 **Sega Mega Drive** 开发软件。 它包含开发库本身(附带源代码)和一些用于编译资源的定制工具。 SGDK 使用 GCC 编译器(m68k-elf 目标)和 libgcc 来生成 ROM 镜像。为方便起见,提供了适用于 Windows 操作系统的二进制文件(GCC 13.2),但您需要为其他操作系统自行安装(有关更多信息,请参见 *帮助与支持* 部分)。 请注意,SGDK 也需要 Java(定制工具需要它),因此您需要在系统中安装 Java。 SGDK 库和定制工具根据 MIT 许可证分发(详见 [license.txt](license.txt) 文件)。 GCC 编译器和 libgcc 根据 GNU 许可证(GPL3)授权,任何基于它们构建的软件(如 SGDK 库)均受 GCC 运行时库例外许可证保护(详见 [COPYING.RUNTIME](COPYING.RUNTIME) 文件)。 ## 入门指南 首先,您需要知道 SGDK 使用 C 语言(也可以使用汇编,但非必需),因此强烈建议在尝试使用 SGDK 开发之前先熟悉 C 编程。同时学习 C 语言和“Sega Mega Drive”编程无疑太过困难,最终可能导致一事无成。同时,对 Sega Mega Drive 硬件(特别是视频系统)具备基本的了解也很重要。 ### MEGA DRIVE 技术资料参考 * And-0 - 出色的 Mega Drive 开发参考资料:
https://github.com/And-0/awesome-megadrive * Raster Scroll - Sega Mega Drive 图形指南:
https://rasterscroll.com/mdgraphics/ * Mega Cat Studios - Sega Mega Drive 图形指南:
https://megacatstudios.com/blogs/retro-development/sega-genesis-mega-drive-vdp-graphics-guide-v1-2a-03-14-17 * Sik 的博客专注于 MD 汇编编程,但也以清晰易懂的方式解释了许多关于 Sega Mega Drive 硬件的知识:
https://plutiedev.com * Rodrigo Copetti 撰写的一篇关于 Mega Drive 架构的优秀文章:
https://www.copetti.org/projects/consoles/mega-drive-genesis * Genesis 软件手册,包含了您需要了解的关于 Sega Mega Drive 的所有信息:
https://segaretro.org/images/a/a2/Genesis_Software_Manual.pdf ### 安装与文档 当您觉得准备就绪后,就可以继续前进并最终安装 SGDK 了 :) 您可以在 wiki 上找到安装说明和关于如何使用 SGDK 的教程:
https://github.com/Stephane-D/SGDK/wiki SGDK 还附带了一个在线的 doxygen 文档(由 .h 头文件生成),提供了所有 SGDK 结构体和函数的描述:
http://stephane-d.github.io/SGDK/ 需要了解的是,SGDK 高度依赖于通过 _rescomp_ 工具编译的 _资源_。您应该阅读 [rescomp.txt](https://raw.githubusercontent.com/Stephane-D/SGDK/master/bin/rescomp.txt) 文件,以了解**可以使用哪些类型的资源以及如何声明它们**。然后,您可以查看 SGDK 的 *'sample'* 文件夹,特别是 [sonic 样例](https://github.com/Stephane-D/SGDK/tree/master/sample/game/sonic),它很好地展示了 SGDK 的常规用法(函数和资源)。 ### 其他教程 您可以在网上找到很多关于 SGDK 的教程,但请注意,有些教程可能已过时和/或包含错误。
我强烈建议从 [wiki](https://github.com/Stephane-D/SGDK/wiki) 开始,它提供了入门的基础知识。
然后,如果您需要更多 _可视化_ 和完整的教程,可以尝试以下任一资源:
来自 Ohsat 的 MD 编程教程:
https://www.ohsat.com/tutorial/mdmisc/creating-graphics-for-md/
来自 Danibus 的非常完整和可视化的教程(仅西班牙语):
https://danibus.wordpress.com/
来自 Pigsy 的 YouTube 教程系列:
https://www.youtube.com/watch?v=BnGqc5OTTY4&list=PL1xqkpO_SvY2_rSwHTBIBxXMqmek--GAb
### 实用工具 以下是一些实用的工具列表,可帮助您创建资源: #### 像素画 / 精灵图 * [Asesprite](https://www.aseprite.org/) * [Graphics gale](https://graphicsgale.com/) * [Pro Motion](https://www.cosmigo.com/) * [Grafx2](http://grafx2.chez.com/) * [Palette quantizer](https://rilden.github.io/tiledpalettequant/):一个强大的在线工具,可在 Sega Mega Drive 调色板限制内转换您的图像。 #### 地图 / 关卡 * [16Tile](https://allone-works.itch.io/16tile):SGDK 专用的图块地图编辑器 * [PNGPalPrio4SGDK](https://github.com/Rahzelk/pngpalprio4sgdk):SGDK 专用的 PNG 图像编辑器,让您可以轻松设置图块调色板索引和优先级信息 * [Tiled](https://www.mapeditor.org/):图块地图编辑器,受 SGDK 资源编译器工具支持 * [LDTK](https://deepnight.net/tools/ldtk-2d-level-editor/):新兴但功能强大的图块地图编辑器(也支持 Tiled 格式) * [Ogmo](https://ogmo-editor-3.github.io/):另一款优秀且简单的图块地图编辑器 * [Palette merger](https://github.com/bolon667/paletteMergerForSGDK):一个允许轻松更改图块调色板索引和优先级的工具 #### 音乐 / 音效 * [Deflemask](https://www.deflemask.com/):支持多种系统(如 Sega Mega Drive)的音乐追踪器 * [Furnace](https://github.com/tildearrow/furnace):新的支持多种系统的音乐追踪器 * [Wavosaur](https://www.wavosaur.com/):波形声音编辑器(仅 Windows) * [Audacity](https://www.audacityteam.org/):波形声音编辑器(所有操作系统) #### 替代音效驱动 SGDK 的音效驱动可能无法满足您的需求,因此了解存在一些替代方案很重要: ### LINUX / MACOSX 有多种方案可以让 SGDK 在 Linux 上运行,以下是一些列表:
* Vojtěch Salajka 提供的非常简单的脚本,让您可以通过 Wine 轻松使用 SGDK:
https://github.com/Franticware/SGDK_wine * tlsa 的 SGDK Helper 让您可以在原生或容器环境中使用 SGDK:
https://github.com/tlsa/sgdk-helper * 另一个不错的选择是使用 Andy Grind 开发的完整 _MarsDev_ 环境:
https://github.com/andwn/marsdev 它支持所有操作系统,提供 SGDK 兼容性以及 32X 支持,务必查看一下! * MacOSX 用户还可以使用 Sonic3D 提供的此特定解决方案(可能稍显过时):
https://github.com/SONIC3D/gendev-macos ### DOCKER SGDK 不再提供任何集成的 Docker 解决方案,因为 Doragasu 的 Docker 解决方案似乎更好、更快且更易于使用(原生 Linux 编译器):
https://gitlab.com/doragasu/docker-sgdk ### VS CODE 现在几乎所有人都使用 VS Code 编辑器,zerasul 制作的优秀扩展 *Genesis-Code* 使 SGDK 集成更加顺畅:
https://marketplace.visualstudio.com/items?itemName=zerasul.genesis-code 只需安装并按照扩展页面上的说明进行设置(主要是 'GDK/SGDK' 和 'Gens' 模拟器路径),您就可以开始使用了 :)
您可以在命令面板(快捷键 Ctrl+Shift+P)中输入 *>Genesis* 来查看该扩展支持的所有命令。
SGDK 现在还在 _project/template_ 文件夹中集成了一个 VSCode 模板,因此您可以直接复制该文件夹(例如 _project/test_),然后在 VSCode 中打开它,开始您自己的项目。 ### AWS 是的,您没看错,感谢 Matthew Nimmo,您现在甚至可以从 AWS 使用 SGDK!
以下是他的博客链接,解释了如何操作:
https://community.aws/content/2hZInsYwWX8cYEAIFKquutVoYQj/how-to-build-retro-games-in-aws-using-sega-genesis-development-kit-sgdk ## 致谢 ## 特别致谢 - Bitmap Bureau(Xeno Crisis 团队) - Neofid Studios(Demons of Asteborg 团队) - Dmitry (D I) - Rajen Savjani ## SGDK 驱动! 以下项目已知是基于 SGDK 构建的 _(非详尽列表)_: ![alt text](https://static.pigsec.cn/wp-content/uploads/repos/2026/05/eba94455f7094402.gif) Tanzer by [Mega Cat Studios](https://megacatstudios.com/products/tanzer-sega-genesis) ![alt text](https://static.pigsec.cn/wp-content/uploads/repos/2026/05/ac043e0841094403.gif) MASIAKA by [Resistance](https://www.pouet.net/prod.php?which=71543) ![alt text](https://static.pigsec.cn/wp-content/uploads/repos/2026/05/78f5dbd2e3094405.gif) Xeno Crisis by the [Bitmap Bureau](https://www.bitmapbureau.com/) ![alt text](https://static.pigsec.cn/wp-content/uploads/repos/2026/05/2363c8be1b094406.gif) Demons of Asteborg [Neofid Studios](https://neofid-studios.com/) ### SGDK 驱动的游戏和演示随机列表 * [2048](https://github.com/atamurad/sega-2048) by atamurad * [Abbaye des Morts (l')](https://playonretro.itch.io/labbaye-des-morts-megadrivegenesis-por-002) unofficial MD port by Moon-Watcher * [Art of LeonBli (the)](https://www.pouet.net/prod.php?which=72272) by Resistance * [Barbarian](https://www.youtube.com/watch?v=e8IIfNLXzAU) unofficial MD port by Z-Team * [Demons of Asteborg](https://demonsofasteborg.com/) by Neofid Studio * [Devwill Too MD](https://amaweks.itch.io/devwill-too-md) by Amaweks * [Fatal Smarties](https://globalgamejam.org/2016/games/fatal-smarties) made for the GGJ 2016 * [Fullscreen NICCC 2000](https://www.pouet.net/prod.php?which=81136) by Resistance * [IK+ Deluxe](https://www.youtube.com/watch?v=mcm0TRsOwuw) unofficial MD port by Z-Team * [Irena](https://white-ninja.itch.io/irena-genesis-metal-fury) by White Ninja Studio * [Omega Blast](https://nendo16.jimdofree.com/omega-blast/) by Nendo * [Perlin & Pinpin](https://lizardrive.itch.io/perlin-pinpin-episode1) by Lizardrive * [Right 2 Repair](https://supermegabyte.itch.io/right-2-repair) by Super Megabyte made for the GGJ 2020 * [Return to Genesis](https://www.youtube.com/watch?v=jjy0Iz_64dY) unofficial MD port by Z-Team * [Road to Valhalla](https://www.pouet.net/prod.php?which=72961) by Bounty/Banana & Resistance * [Spiral (the)](https://www.pouet.net/prod.php?which=82607) by Resistance * [TCK](https://www.cursed-knight.fr/cursed-knight-fr.php) by GGS Studio Creation * [Tetris MD](https://github.com/NeroJin/TetrisMD) unofficial MD port by Nero Jin * [ThunderCats MD](https://github.com/mxfolken/thundercats_megadrive) by Rolando Fernández Benavidez. * [Travel](https://www.pouet.net/prod.php?which=65975) by Resistance * [Wacky Willy Weiner Sausage Surfer](https://globalgamejam.org/2017/games/wacky-willy-weiner-sausage-surfer) made for the GGJ 2017
标签:GCC编译器, JS文件枚举, ROM制作, Sega Mega Drive, 免费工具, 复古开发, 复古游戏机, 客户端加密, 嵌入式系统, 开发套件, 技术文档, 游戏开发, 游戏编程, 硬件编程, 编程学习, 资源编译