PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
midimeta.c
1/*
2# _____ ___ ____ ___ ____
3# ____| | ____| | | |____|
4# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5#-----------------------------------------------------------------------
6# Copyright ps2dev - http://www.ps2dev.org
7# Licenced under Academic Free License version 2.0
8# Review ps2sdk README & LICENSE files for further details.
9*/
10
11#include "libsnd2_internal.h"
12
13void _SsGetMetaEvent(s16 sep_no, s16 seq_no, u8 meta_event)
14{
15 libsnd2_sequence_struct_t *score_struct;
16 u8 v4;
17 u8 v6;
18 int v7;
19 unsigned int v8;
20 int v9;
21 int v10;
22 unsigned int v11;
23
24 (void)meta_event;
25
26 score_struct = &_ss_score[sep_no][seq_no];
27 v4 = *(score_struct->m_seq_ptr);
28 score_struct->m_seq_ptr += 1;
29 v6 = *(score_struct->m_seq_ptr);
30 score_struct->m_seq_ptr += 1;
31 v7 = 60000000 / ((v4 << 16) | (v6 << 8) | *(score_struct->m_seq_ptr));
32 score_struct->m_seq_ptr += 1;
33 v8 = score_struct->m_resolution_of_quarter_note * v7;
34 v9 = VBLANK_MINUS;
35 v10 = 16 * VBLANK_MINUS;
36 score_struct->m_unk94 = v7;
37 v11 = 4 * (v10 - v9);
38 if ( 10 * v8 < v11 )
39 {
40 unsigned int v13;
41
42 if ( !v8 )
43 __builtin_trap();
44 v13 = 600 * v9 / v8;
45 score_struct->m_unk52 = v13;
46 score_struct->m_unk54 = v13;
47 }
48 else
49 {
50 unsigned int v15;
51 unsigned int v16;
52
53 v15 = 10 * score_struct->m_resolution_of_quarter_note * score_struct->m_unk94 / v11;
54 v16 = 10 * score_struct->m_resolution_of_quarter_note * score_struct->m_unk94 % v11;
55 score_struct->m_unk52 = -1;
56 score_struct->m_unk54 = v15;
57 if ( (unsigned int)(2 * (v10 - v9)) < v16 )
58 {
59 score_struct->m_unk54 = v15 + 1;
60 }
61 }
62 score_struct->m_delta_value = _SsReadDeltaValue(sep_no, seq_no);
63}