Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - SaturnTeam

Pages: 1 [2] 3 4 5
16
General Jo Engine Help / Re: How to autoload game after video
« on: July 15, 2018, 06:22:02 pm »
I am still working on this. I have been reading through the engine code to see how the videos are loaded and played. Before, it was getting hung up on just finding the file and reading the size. Now, I have everything in one file and have moved most of the video code to the top of the file. Before, most of the code was mixed in lower parts of the file. In the demo, the video is loaded in jo_main with a function up above that signifies the stopping of the video. Of course, the demo is just running one asset, so there is no confusion. Now that I have moved the code into a new function at the top of the file, I am no longer getting the first errors in the error list the code is supposed to run through, which was finding the file and getting the size. It has moved down the list to the error for creating the video before it plays. I can get it to the point where I can see the multicolor lines on the screen where it is trying to play the video, but the game freezes underneath it.

17
General Jo Engine Help / Re: How to autoload game after video
« on: July 12, 2018, 07:31:19 pm »
My attempt to run it from another C file failed. Now, I've been trying to run everything from the main file. I keep getting the error: in_jo_fs_get_file_size(): GFS_Open() failed. I've tried setting a max malloc size in the makefile, enabling ram card support, and turning on sgl. Nothing works. I have no clue what to do. I have Yabuase set to use the 4MB ram cart. My game disc data is close to 4MB total.

18
General Jo Engine Help / Re: How to autoload game after video
« on: July 11, 2018, 11:48:33 pm »
Update: I think I have most of the right code, but I still can't figure it out.

EXECUTION CODE IN MAIN.C:
Code: [Select]
#include "video.h"

#define jo_extended_ram_cartridge_type(CART_32MBits)

void     jo_main(void)
{
    jo_core_init(JO_COLOR_Black);
    jo_core_suspend();
//    jo_malloc(sizeof(int));
    jo_core_add_callback(my_draw2);
    jo_core_add_callback(my_video_stopped);
    jo_core_add_callback(jo_main2);
if (jo_video_open_file("SAMPLE.CPK"))
        jo_video_play(my_video_stopped);
    jo_free((void*) video);
    jo_core_suspend();
...blablabla
}

HEADER FILE:
Code: [Select]
#ifndef __VIDEO_H__
# define __VIDEO_H__


#include <jo/jo.h>

#define jo_extended_ram_cartridge_type(CART_32MBits)

const int *video;

void     my_draw2(void)
{
    video = jo_video_open_file; //0x06024970 0x044   0x80   0x013  0x1F8
    const int *video = (const int*) jo_malloc(268000*sizeof(int));
    if(video == NULL)
    {
        jo_printf(1, 2, "Unable to allocate memory", jo_get_last_error());
//        jo_printf(0, 1, "Address of video variable: %d\n", *video);
//        return JO_NULL;
    }
    // Yes, it consume a lot of memory during playing :)
    jo_printf(0, 0, "Dynamic memory usage: %d%%  ", jo_memory_usage_percent());

    jo_sprite_draw3D(jo_get_video_sprite(), 0, 0, 170);
}

void                my_video_stopped(void)
{
    jo_printf(0, 1, "Done.");
}

void     jo_main2(void)
{
jo_core_init(JO_COLOR_Transparent);
jo_core_add_callback(my_draw2);
// if (jo_video_open_file("SAMPLE.CPK"))
//        jo_video_play(my_video_stopped);
jo_core_run();
}
#endif /* !__VIDEO_H__ */

/*
** END OF FILE
*/

Other than that, I added JO_COMPILE_WITH_RAM_CARD_SUPPORT to my makefile. I think I'll start working on a different approach. I think if I make it a separate video C file in a different folder, I might be able to get it to work. I'm just about done for today. I had to make one of the background colors transparent, because most of the time the error information was getting covered by black all over the screen. I am getting two errors: NULL pointer in jo_free, and GFS cannot determine file size.

19
General Jo Engine Help / Re: How to autoload game after video
« on: July 11, 2018, 04:07:01 pm »
Yeah. That's something I've come across while working on this. I think I'm getting close to solving it. I was making progress last night. I'm going to work on it today. If I don't get it working, I'll post the code that I'm using so I can get more eyeballs on the code. If I get it working, I'll post how I did it. One of the problems I've run across is that, compared to how it's noted in the source document, different coding sites give slightly different implementation examples. Some of the coding tutorials conform to C and others to C++.

20
General Jo Engine Help / Re: How to autoload game after video
« on: July 10, 2018, 06:53:00 pm »
Yeah, that seems to be what I'm missing. I'm using the suspend command to hold the game until the video plays, but I need the free command to clear the memory. I'm still trying to figure it out, but I haven't had much luck. I've been looking at addresses that get returned in debug in Yabause, but I'm not totally clear on how to set up the malloc and free commands in the code.

Johannes, can you explain how this is supposed to work? I've been reading up on how malloc normally works in C coding, but I keep getting address or file size errors.

21
General Jo Engine Help / How to autoload game after video
« on: July 09, 2018, 09:02:04 pm »
I'm not sure if this is straight forward or not. I'm trying to figure out if there needs to be a jump from one C file to the main or running a header file from the main file. Should the video C or header file be in a separate directory? Right now, I keep running out of memory due to all the assets being loaded at the same time. I want to run the video, clear that, and then load the game assets.

22
I wanted to share this incredible interview with the Panzer Dragoon Saga developers for the 20th anniversary of the game's release: Panzer Dragoon Saga: an oral history https://www.polygon.com/2018/4/30/17286042/panzer-dragoon-saga-sega-saturn-oral-history.

23
Share your code / Ship shadow for shooter demo
« on: July 06, 2018, 12:39:32 am »
I wanted to share how to set up the shadow for the main ship in the shooter demo. You'll go under draw_ship in your main C file and enter in the following code under the code that's already there:

Code: [Select]
    // SHIP SHADOW
    jo_sprite_enable_shadow_filter();
    jo_sprite_change_sprite_scale(-2.5);
    if (ship.move == RIGHT)
        jo_sprite_enable_horizontal_flip();
    jo_sprite_draw3D(ship.reverse_animation ? jo_get_anim_sprite_reverse(ship.anim_id) : jo_get_anim_sprite(ship.anim_id), ship.x +5, ship.y -25, 800);
    if (ship.move == RIGHT)
        jo_sprite_disable_horizontal_flip();
    jo_sprite_restore_sprite_scale();
    jo_sprite_disable_shadow_filter();

So I've set the trailing shadow scale to 2.5x less than the actual ship size, in order to present the appearance of distance. At the ship's coordinates (ship.x and ship.y), I've shifted the shadow so it is visible, due to not being directly underneath the ship. You'll have to change the numbers based on your specific game. The Z coordinate of 800 is lower than the coordinate for the ship. This technique can be applied to other craft, too.

24
General Jo Engine Help / Re: Request for real hardware tests
« on: July 05, 2018, 09:33:33 pm »
Okay. I got it working. The first time, I pressed on the directional pad and the game froze. The second time, at 1:43, the audio went into a feedback loop. I didn't get any static before that. It just kept playing that second of the audio over and over.

25
General Jo Engine Help / Re: Request for real hardware tests
« on: July 05, 2018, 09:13:22 pm »
I commented out line 20, but I'm still getting errors from lines 28, 29, and 31. If I comment those out, I get a message saying that there were multiple ISOs found in the project and it doesn't open in Yabause. Oh, I didn't see that you had uploaded that file. Let me try it again.

26
General Jo Engine Help / Re: Request for real hardware tests
« on: July 05, 2018, 08:47:28 pm »
My test application didn't work, because I tried running the music PCM on channel 0 and it ran out of PCM memory. I figured that might happen. Can you insert the Kai module into your makefile and re-upload the sl_coff.iso? That should be enough for me to load it on my Saturn. Let me know when you've done that, and I'll try it again.

27
General Jo Engine Help / Re: Request for real hardware tests
« on: July 05, 2018, 07:56:19 pm »
I downloaded the files. Before I burn another CD-R (I don't have many left), I wanted to mention that it won't compile. Here are the warnings and errors I'm getting:
ZT/ZT_CD.c:20: warning: implicit declaration of function 'STM_WORK_SIZE'
ZT/ZT_CD.c:20: error: variable-size type declared outside of any function
ZT/ZT_CD.c: In function 'ztCDinit':
ZT/ZT_CD.c:28: warning: implicit declaration of function 'PCM_Init'
ZT/ZT_CD.c.29: warning: implicit declaration of function 'STM_Init'
ZT/ZT_CD.c.31: warning: implicit declaration of function 'PCM_DeclareUseAdpcm'
make: *** [ZT/ZT_CD.c] Error 1
._sl_coff.iso found
Access to the path '\RTFK\._sl_coff.cue' is denied.

------
I could just make a simple application to test the PCM files if you want. I don't see why that wouldn't work. Is the music file 8-bit or 16-bit? I need to know how to mark it in my test application. Also, is it mono or stereo?

28
General Jo Engine Help / Re: Request for real hardware tests
« on: July 05, 2018, 07:13:17 pm »
Well, I am disappointed. I wanted to help you, but it isn't working. I burnt it to one of my dev CDs that I use for my own game testing. I ran it on my US Model 1 MK 80000, made in Japan in 1995. I tried using both game loaders on Pseudo Saturn Kai, but it won't load. It just gets stuck at the Sega screen. If you want to, you could post the audio file and I could set up my own ISO. Did you add the "JO_PSEUDO_SATURN_KAI_SUPPORT = 1" module in the makefile?

29
General Jo Engine Help / Re: Request for real hardware tests
« on: July 05, 2018, 05:21:59 pm »
Which Saturn version are you testing it on? Can you give me the model number?

30
I figured it out! It feels good to actually get something working. I had forgotten to add the storyboard module in the makefile. After getting continual errors and warnings, I realized I didn't even need the extra C file. The communication between the three files was just a nightmare. I just dumped the code into the header file and made some alterations. Below is what I did, so others can execute the same thing for their projects:

MAKEFILE LINE:
Code: [Select]
JO_COMPILE_WITH_STORYBOARD_MODULE = 1

HEADER:
Code: [Select]
#ifndef __STORYBOARD_H__
# define __STORYBOARD_H__

#include <jo/jo.h>

// A custom structure to show that you can use customs as well as jo_2d_object_attributes, jo_pos2D, etc.

typedef struct
{
    /* Must be the first field in our custom structure in order to let the storyboard retrieve where the location of our object is */
    jo_2d_object_attributes     attributes;
    int                         sprite_id;
    // Add other attributes here or not ;)
}                               circular_saw_t;

static circular_saw_t           saws[2];
static jo_pos2D                 drone;
static jo_pos2D                 sentry;

static int                      sentry_sprite_id;
static int                      drone_sprite_id;

static jo_storyboard            *drone_storyboard;

void                            animate_circular_saws(void)
{
    jo_storyboard               *storyboard;
    jo_animation                *animation;

    // We create a new storyboard for all saw (that means that you can use the same storyboard with multiple object)
    storyboard = jo_storyboard_create(true, false);
    // Now we add a new custom animation (smooth translation + rotation) (that means that you can add multiple animation)
    animation = jo_storyboard_create_animation(storyboard, 0, 0);
    animation->sin_radius = 80;
    animation->translation_speed_y = 2;
    animation->rotation_speed = 10;
    // Now we can animate any object
    jo_storyboard_add_object(storyboard, &saws[0]);
    jo_storyboard_add_object(storyboard, &saws[1]);
    // Next step in my_draw()
}

void                            animate_drone(void)
{
    //jo_storyboard_create_for_object() = jo_storyboard_create() + jo_storyboard_add_object()
    drone_storyboard = jo_storyboard_create_for_object(true, true, &drone);
    jo_storyboard_create_translation_animation_using_direction(drone_storyboard, RIGHT, 1, 160);
    jo_storyboard_create_translation_animation_using_direction(drone_storyboard, DOWN, 1, 160);
    jo_storyboard_create_translation_animation_using_direction(drone_storyboard, LEFT, 1, 160);
    // You can also translate in any direction (angle)
    jo_storyboard_create_translation_animation(drone_storyboard, 270, 1, 160);
    // You can create complex animation :)
}

void                            animate_sentry(void)
{
    // There is many powerful helpers in jo/storyboard.h
    // jo_storyboard_move_object_in_circle() = jo_storyboard_create() + jo_storyboard_add_object() + jo_storyboard_create_circle_animation()
    jo_storyboard_move_object_in_circle(&sentry, 90, 1, JO_STORYBOARD_INFINITE_DURATION);
}

void                            init_circular_saw_sprite_and_position(void)
{
    // First saw
    saws[0].attributes.z = 500;
    saws[0].attributes.x = -50;
    saws[0].sprite_id = jo_sprite_add_tga(JO_ROOT_DIR, "SAW.TGA", JO_COLOR_Green);
    // Second saw
    saws[1].attributes.x = 50;
    saws[1].attributes.z = saws[0].attributes.z; // Same z position
    saws[1].sprite_id = saws[0].sprite_id; // Same sprite
}

void                            init_drone_sprite_and_position(void)
{
    drone_sprite_id = jo_sprite_add_tga(JO_ROOT_DIR, "EMY.TGA", JO_COLOR_Green);
    drone.x = -80;
    drone.y = -80;
}

void                            init_sentry_sprite_and_position(void)
{
    sentry_sprite_id = jo_sprite_add_tga(JO_ROOT_DIR, "CAM.TGA", JO_COLOR_Green);
    sentry.x = 0;
    sentry.y = 0;
}

#endif /* !__STORYBOARD_H__ */

/*
** END OF FILE
*/
So I took out the gamepad part, because I didn't need it. I moved the important info in my_draw and jo_main to my main file, and deleted those sections in the header file. Here is the needed code in the main C file:
Code: [Select]
#include "storyboard.h"

void                my_draw(void)
{
    jo_sprite_draw3D_and_rotate(saws[0].sprite_id, saws[0].attributes.x, saws[0].attributes.y, saws[0].attributes.z, saws[0].attributes.rz);
    jo_sprite_draw3D_and_rotate(saws[1].sprite_id, saws[1].attributes.x, saws[1].attributes.y, saws[1].attributes.z, saws[1].attributes.rz);
    jo_sprite_draw3D(drone_sprite_id, drone.x, drone.y, 550);
    jo_sprite_draw3D(sentry_sprite_id, sentry.x, sentry.y, 400);
}

void     jo_main(void)
{
init_circular_saw_sprite_and_position();
init_drone_sprite_and_position();
init_sentry_sprite_and_position();
animate_circular_saws();
animate_drone();
animate_sentry();
}
There you have it! Thanks, ponut64!

Pages: 1 [2] 3 4 5
SMF spam blocked by CleanTalk