Skip to content

David-Vandensteen/neocore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1,957 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

NeoCore

NeoCore Logo

Platform License: MIT GitHub last commit GitHub repo size NeoGeo-CD Uses Doxygen

๐ŸŽฏ Overview

NeoCore is a library and toolchain for developing on Neo Geo CD.

It provides high-level functions over Neo Dev Kit and DATlib 0.3, and includes tools and code that can help with projects on this platform.

โœจ Key Features

  • ๐Ÿš€ High abstraction level for Neo Geo CD development
  • ๐Ÿ”ง Toolchain with PowerShell scripts
  • ๐ŸŽฎ Compatible with Windows 11
  • ๐Ÿ“– Documentation generated with Doxygen
  • ๐Ÿ”„ Hot reload for rapid development

๐Ÿ”— Quick Links

๐Ÿ“š Table of Contents


Requirements


๐Ÿ“… Roadmap

๐ŸŸข Completed (v3.4.0)

  • โœ… neocore version switcher script for standalone projects
  • โœ… One-liner command for project creation
  • โœ… Mak lint command for project validation
  • โœ… Integrate city41/mameNeoGeoDevPlugin (use \.\mak.bat run:mame:debug to enable it)
    • โœ… Fork and tweak for NeoCore - neocore-mameNeoGeoDevPlugin
    • โœ… Add Windows compatibility
    • โœ… Add Neo-Geo CD MAME compatibility
    • โœ… Upgrade MAME for plugin API compatibility

๐ŸŸข Completed (v3.4.1)

  • โœ… Upgrade Raine emulator to 0.97.5
  • โœ… Fix issue 211: Incorrect CUE file paths when generating ISO with MP3 CDDA tracks (mak dist:iso)

๐ŸŸข Completed (v3.4.3)

  • โœ… DATlib JobMeter
  • โœ… Automatic generation of a structure aggregating a pointer to sprite data in ROM and a pointer to palette information in ROM during sprite compilation

๐ŸŸก In Progress

  • ๐Ÿ”œ Hiding obsolete branches and tags in neocore version switcher script
  • ๐Ÿ”œ NeoCore 4
    • ๐Ÿ”œ Remove deprecated functions, macros and structures since NeoCore 3.1.1
    • ๐Ÿ”œ GCC 13 (in progress : 50%)
    • ๐Ÿ”œ Embed math.h in NeoCore lib
    • ๐Ÿ”œ Migration guide

๐Ÿ”ต Planned - Soon

  • ๐Ÿ”œ Move src-lib/neocore.h into src-lib/include
  • ๐Ÿ”œ Runtime palette creation: instantiate sprites with palettes built in RAM (may be delayed after NeoCore 4)

๐Ÿ”ต Planned - Later

  • ๐Ÿ”œ Refactor nc_gfx* functions
  • ๐Ÿ”œ AES / MVS support (5% completed)
    • โœ… Externalized CDDA functions (completed in v3.4.4)
    • โœ… Added auto-generated out/platform.h to define the platform type (CD or Cartridge) (completed in v3.4.4)
    • ๐Ÿ”œ Lib CD Makefile
    • ๐Ÿ”œ Lib Cartridge Makefile
    • ๐Ÿ”œ Generate hash and rom file for Mame
  • ๐Ÿ”œ RGB palette handlers (60% completed)
    • Samples: pal_backdrop, pal_rgb, pal_rgb_mixer
  • ๐Ÿ”œ Joypad 2 support
  • ๐Ÿ”œ Improve sound FX management
  • ๐Ÿ”œ Palette bank switcher
  • ๐Ÿ”œ DRAM asset management (unload/load from CD-ROM)

๐Ÿง Under Consideration

  • ๐Ÿ’ญ Add basic modular C lib system for reusable functions and assets
  • ๐Ÿ’ญ Split project.xml to separate user parameters from toolchain parameters
  • ๐Ÿ’ญ Video recording support (MAME MNG format with manual ffmpeg conversion to MP4)
  • ๐Ÿ’ญ XML WYSIWYG editor
  • ๐Ÿ’ญ Memory card support
  • ๐Ÿ’ญ CLI-based asset packager
  • ๐Ÿ’ญ Split project.xml to separate user parameters from toolchain parameters
  • ๐Ÿ’ญ Evaluate DATlib โ†’ libNG (TheHpman/libNG)
  • ๐Ÿ’ญ Raine version selection
  • ๐Ÿ’ญ MAME version selection

๐Ÿš€ Quick Start

Three-Step Setup

1๏ธโƒฃ Create Your Project

๐Ÿ’ก No need to clone or download NeoCore - the script does everything for you!

โš ๏ธ Avoid spaces in paths (use C:\MyGame not C:\My Game)

md C:\MyGame && cd C:\MyGame
curl -L https://raw.githubusercontent.com/David-Vandensteen/neocore/master/bootstrap/scripts/project/create_from_oneliner.bat -o c.bat && c.bat && del c.bat
cd src
.\mak.bat sprite && .\mak.bat && .\mak.bat run:mame

2๏ธโƒฃ Next Steps


โš™๏ธ Command Reference

โš ๏ธ Warning: The mak script overrides the PATH environment variable during compilation. If you encounter any problems after using it, simply close and restart a new command terminal.

๐Ÿ”จ Development Cycle

Building:

Command Description
.\mak.bat sprite Build sprites from assets
.\mak.bat Compile C code and link
.\mak.bat lib Compile NeoCore library
.\mak.bat clean Remove built resources
.\mak.bat clean:build Remove entire build folder

Testing:

Command Description
.\mak.bat run:raine Run with Raine emulator
.\mak.bat run:mame Run with MAME emulator
.\mak.bat run:mame:debug Run with MAME in debug mode (ngdev plugin)
.\mak.bat serve:mame Run in hot reload mode

Development Workflows

# Initial development (build everything)
.\mak.bat sprite && .\mak.bat && .\mak.bat run:raine

# Code-only modifications (sprites unchanged)
.\mak.bat && .\mak.bat run:raine  # โšก Faster!

# Quick test without recompilation
.\mak.bat run:raine  # ๐Ÿš€ Instant!

Build Step

Step Command Purpose When to use
1. Sprites .\mak.bat sprite Generate sprite data from assets When assets change
2. Compile .\mak.bat Compile C code and link When code changes
3. Run .\mak.bat run:raine Launch in emulator Always for testing

C89/ANSI C Strict Compliance

โš ๏ธ CRITICAL: This project uses gcc-2.95.2 and requires strict C89 (ANSI C) compliance.

Key Rules:

  • Declare all variables at the beginning of blocks
  • Declare loop variables outside loops
  • No mixed declarations and code
๐Ÿ“– Click for C89 compliance examples

1. All variables must be declared at the beginning of blocks:

/* โœ… CORRECT */
int function(void) {
    int i;
    char* buffer;

    i = 0;
    buffer = NULL;
    /* code here */
}

/* โŒ WRONG - will not compile */
int function(void) {
    int i = 0;
    doSomething();
    char* buffer = NULL;  /* ERROR: declaration after statement */
}

2. Loop variables must be declared outside loops:

/* โœ… CORRECT */
int i;
for (i = 0; i < 10; i++) {
    /* code */
}

/* โŒ WRONG */
for (int i = 0; i < 10; i++) {  /* ERROR: C99+ feature */
    /* code */
}

3. No inline variable initialization in declarations (unless constant):

/* โœ… CORRECT */
int x;
x = getValue();

/* โŒ WRONG (unless getValue() is a constant) */
int x = getValue();
Command Description
.\mak.bat lint Validate project (project.xml, .gitignore, legacy code)
.\mak.bat framer Launch DATlib Framer
.\mak.bat animator Launch DATlib Animator

๐Ÿ“ฆ Distribution

Command Description
.\mak.bat dist:iso Create ISO distribution package
.\mak.bat dist:mame Create MAME distribution package
.\mak.bat dist:exe Create Windows standalone executable

โ„น๏ธ Information

Command Description
.\mak.bat --version Display version information

๐ŸŽฎ Custom Emulator Profiles

You can create custom emulator profiles for different testing scenarios. NeoCore comes with default profiles (default, full, nosound, debug for MAME), but you can add your own.

Creating Custom MAME Profiles:

Add custom profiles to your project.xml:

<project>
  <emulator>
    <mame>
      <profile>
        <!-- Default profiles are already included -->
        <myprofile>-window -skip_gameinfo -throttle neocdz</myprofile>
        <benchmark>-window -skip_gameinfo -nothrottle -bench 60 neocdz</benchmark>
        <record>-window -skip_gameinfo -aviwrite output.avi neocdz</record>
      </profile>
    </mame>
  </emulator>
</project>

Creating Custom Raine Configurations:

Create custom config files in your project and reference them:

<project>
  <emulator>
    <raine>
      <config>
        <!-- Default configs are already included -->
        <myconfig>raine\config\myconfig.cfg</myconfig>
        <test>raine\config\test.cfg</test>
      </config>
    </raine>
  </emulator>
</project>

Usage:

# Use your custom MAME profiles
.\mak.bat run:mame:myprofile
.\mak.bat run:mame:benchmark
.\mak.bat run:mame:record

# Use your custom Raine configs
.\mak.bat run:raine:myconfig
.\mak.bat run:raine:test

# Default profiles (included with NeoCore)
.\.mak.bat run:mame:full      # Fullscreen
.\mak.bat run:mame:debug     # Debug mode with ngdev plugin
.\mak.bat run:raine:full     # Fullscreen

๐Ÿž Debug Mode with ngdev Plugin

The debug profile provides enhanced Neo Geo CD debugging capabilities:

.\mak.bat run:mame:debug

MAME Debug with ngdev Plugin

Plugin Information:


Project Management

๐Ÿ†™ Upgrade an Existing Project

โš ๏ธ Important: Backup your project before upgrading.

Using Version Switcher

The version switcher provides a simple way to upgrade or switch between NeoCore versions:

# From your project root directory
cd C:\temp\MyGame

# Upgrade to latest stable version
.\neocore-version-switcher.bat master

# Or switch to a specific version
.\neocore-version-switcher.bat 3.2.0

# List all available versions
.\neocore-version-switcher.bat --list

๐Ÿ“ค Release a Project

From your project's src folder:

# ISO distribution
.\mak.bat dist:iso

# MAME distribution
.\mak.bat dist:mame

# Windows standalone executable (game + emulator)
.\mak.bat dist:exe

๐Ÿ“– Documentation & Resources

๐Ÿ“š C API Documentation

๐ŸŽจ DATlib Assets

DATlib Documentation:

Configuration in project.xml:

<project>
  <gfx>
    <DAT>
      <chardata>
        <!-- DATlib configuration -->
      </chardata>
      <fixdata>
        <!-- DATlib fixdata configuration -->
      </fixdata>
    </DAT>
  </gfx>
</project>

DATlib Tools:

.\mak.bat framer     # Launch DATlib Framer
.\mak.bat animator   # Launch DATlib Animator

๐Ÿ“Š Profiling

Job Meter - CPU Profiling Tool

The Job Meter is a visual profiling tool from DATlib that helps developers understand CPU time distribution across different parts of their game loop. It displays a color-coded vertical bar on the right side of the screen, showing which operations are consuming frame time.

Job Meter Example

Key Features:

  • ๐ŸŽจ Color-coded profiling: Each color represents a different operation
  • ๐Ÿ“Š Real-time visualization: See CPU usage live as your game runs
  • ๐ŸŽฏ Performance optimization: Identify bottlenecks quickly

Important Notes:

โš ๏ธ Debug Only: Job meter should only be used in debug builds. On real hardware, changing colors during active display creates visible pixel artifacts.

โš ๏ธ Initialization Order: jobMeterSetup() must be called AFTER sprite and graphics initialization, not as the first function.

Complete Example:

Check the job_meter sample for a fully interactive demonstration with:

  • Real-time CPU load adjustment
  • Multiple profiling sections
  • Visual feedback and color reference
  • Configurable artificial overhead

Learning Resources:


๐ŸŽต Audio Configuration

CDDA (CD Digital Audio) Configuration

Quick Facts:

  • Track ID 1 is reserved for the binary program
  • Use WAV files for source audio (automatic MP3 conversion for distribution)
  • Mixed source formats supported (WAV, MP3)
๐Ÿ“– Click for complete CDDA configuration example

Configuration structure:

<project>
  <sound>
    <cd>
      <cdda>
        <dist>
          <iso>
            <format>mp3</format>  <!-- Distribution format -->
          </iso>
        </dist>
        <tracks>
          <track><!-- track id 1 is reserved for the binary program -->
            <id>2</id>
            <file>assets\sounds\cdda\track02.wav</file>
            <pregap>00:02:00</pregap>
          </track>
          <!-- Add more tracks as needed -->
        </tracks>
      </cdda>
    </cd>
  </sound>
</project>

Audio file organization:

assets/
โ””โ”€โ”€ sounds/
    โ””โ”€โ”€ cdda/
        โ”œโ”€โ”€ track02.wav
        โ”œโ”€โ”€ track03.wav
        โ””โ”€โ”€ track04.mp3

Notes:

  • Pregap of 00:02:00 is standard for CD audio
  • Distribution format (MP3) optimizes ISO size

๐Ÿค Contribution

๐ŸŽฏ How to Contribute

Developers:

  • ๐Ÿ“ Create tutorials or code examples
  • ๐Ÿ› Report and fix bugs
  • ๐Ÿ’ก Propose new features
  • ๐Ÿ“š Improve documentation

Neo-Geo CD Owners:

  • ๐Ÿงช Test examples on real hardware
  • ๐Ÿ› Report hardware compatibility issues
  • โœ… Confirm functionality on real hardware

Financial Support: To improve hardware compatibility and project development, any financial contribution is appreciated.

๐Ÿ’ฐ Make a PayPal donation

โš ๏ธ Disclaimers

  • This project is under active development
  • Mainly tested on Raine and MAME emulators
  • No guarantee of functionality on real Neo-Geo hardware
  • The author is not responsible for any software damage

Any help is welcome! ๐Ÿ™


๐ŸŽฎ Game Examples & Showcases


๐Ÿ› ๏ธ Advanced Development

โ™ป๏ธ Hot Reload

Hot reload allows you to automatically recompile and restart your project when making changes:

cd <neocore>\samples\hello
.\mak.bat serve:mame
  1. The emulator launches
  2. Edit main.c
  3. Save the file
  4. The project recompiles and restarts automatically

Current limitations:

  • โš ๏ธ Not a real watcher (triggers only when folder size changes)
  • โš ๏ธ PATH is not restored when interrupted (close/reopen terminal)

๐Ÿ”ง Compile Library

Necessary if you modify NeoCore source code:

.\mak.bat clean
.\mak.bat lib

๐Ÿ“š Dependencies

Core Development Tools

  • GCC - C compiler (version 2.95.2 for C89 compliance)
  • MSYS2 - Unix-like environment for Windows
  • Git - Version control (required for installation)

Neo Geo Development

  • NeoDev - Neo Geo CD development toolkit
  • DATlib - Data library for Neo Geo assets
  • DATimage - Image processing for Neo Geo graphics
  • NGFX SoundBuilder - Audio tool for Neo Geo sound effects

Emulators & Testing

  • Raine - Neo Geo CD emulator
  • MAME - Multi-platform emulator (version 0.251)
  • city41/mameNeoGeoDevPlugin - Enhanced MAME debugging (ngdev fork)

Build & Distribution Tools

  • Mkisofs - ISO image creation
  • NSIS - Windows installer creation
  • mpg123 - MP3 decoder
  • ffmpeg - Audio/video conversion

Documentation

  • Doxygen - API documentation generation

๐Ÿ“ Changelog

Complete version history and changes documentation.


๐Ÿ“„ License

NeoCore is licensed under the MIT license. Copyright 2019 by David Vandensteen. Some graphics by Grass.

About

Library & toolchain for Neo Geo CD develop. with C language

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors