void CModulePropertiesDlg::OnBnClickedSongRemove() { ASSERT(m_iSelectedSong != -1); CListCtrl *pSongList = static_cast<CListCtrl*>(GetDlgItem(IDC_SONGLIST)); CMainFrame *pMainFrame = static_cast<CMainFrame*>(GetParentFrame()); unsigned Count = m_pDocument->GetTrackCount(); CString TrackTitle; if (Count == 1) return; // Single track // Display warning first if (AfxMessageBox(IDS_SONG_DELETE, MB_OKCANCEL | MB_ICONWARNING) == IDCANCEL) return; pSongList->DeleteItem(m_iSelectedSong); m_pDocument->RemoveTrack(m_iSelectedSong); m_pDocument->UpdateAllViews(NULL, UPDATE_TRACK); Count = m_pDocument->GetTrackCount(); // Get new track count // Redraw track list for (unsigned int i = 0; i < Count; ++i) { TrackTitle.Format(_T("#%02i %s"), i + 1, m_pDocument->GetTrackTitle(i).GetString()); pSongList->SetItemText(i, 0, TrackTitle); } if (m_iSelectedSong == Count) SelectSong(m_iSelectedSong - 1); else SelectSong(m_iSelectedSong); }
void CModulePropertiesDlg::OnBnClickedSongRemove() { ASSERT(m_iSelectedSong != -1); CString TrackTitle; unsigned Count = m_pDocument->GetTrackCount(); if (Count == 1) return; // Single track // Display warning first if (AfxMessageBox(IDS_SONG_DELETE, MB_OKCANCEL | MB_ICONWARNING) == IDCANCEL) return; m_pSongList->DeleteItem(m_iSelectedSong); m_pDocument->RemoveTrack(m_iSelectedSong); Count = m_pDocument->GetTrackCount(); // Get new track count // Redraw track list for (unsigned int i = 0; i < Count; ++i) { TrackTitle.Format(_T("#%02i %s"), i + 1, m_pDocument->GetTrackTitle(i)); m_pSongList->SetItemText(i, 0, TrackTitle); } if (m_iSelectedSong == Count) SelectSong(m_iSelectedSong - 1); else SelectSong(m_iSelectedSong); }
void StepManiaLanServer::ParseData(PacketFunctions& Packet, const unsigned int clientNum) { int command = Packet.Read1(); switch (command) { case NSCPing: // No Operation SendValue(NSServerOffset + NSCPingR, clientNum); break; case NSCPingR: // No Operation response break; case NSCHello: // Hello Hello(Packet, clientNum); break; case NSCGSR: // Start Request Client[clientNum]->StartRequest(Packet); CheckReady(); //This is what ACTUALLY starts the games break; case NSCGON: // GameOver GameOver(Packet, clientNum); break; case NSCGSU: // StatsUpdate Client[clientNum]->UpdateStats(Packet); if (!Client[clientNum]->lowerJudge) CheckLowerJudge(clientNum); break; case NSCSU: // Style Update Client[clientNum]->StyleUpdate(Packet); SendUserList(); break; case NSCCM: // Chat message AnalizeChat(Packet, clientNum); break; case NSCRSG: SelectSong(Packet, clientNum); break; case NSCSMS: ScreenNetMusicSelectStatus(Packet, clientNum); break; case NSCUPOpts: Client[clientNum]->Player[0].options = Packet.ReadNT(); Client[clientNum]->Player[1].options = Packet.ReadNT(); break; default: break; } }
void CModulePropertiesDlg::OnBnClickedSongAdd() { CString TrackTitle; // Try to add a track if (!m_pDocument->AddTrack()) return; // New track is always the last one int NewTrack = m_pDocument->GetTrackCount() - 1; TrackTitle.Format(TRACK_FORMAT, NewTrack, m_pDocument->GetTrackTitle(NewTrack)); m_pSongList->InsertItem(NewTrack, TrackTitle); SelectSong(NewTrack); }
void CModulePropertiesDlg::FillSongList() { CString Text; m_pSongList->DeleteAllItems(); // Song editor int Songs = m_pDocument->GetTrackCount(); for (int i = 0; i < Songs; ++i) { Text.Format(TRACK_FORMAT, i + 1, m_pDocument->GetTrackTitle(i)); // start counting songs from 1 m_pSongList->InsertItem(i, Text); } // Select first song when dialog is displayed SelectSong(0); }
void CModulePropertiesDlg::OnBnClickedSongDown() { CString Text; int Song = m_iSelectedSong; if (Song == (m_pDocument->GetTrackCount() - 1)) return; m_pDocument->MoveTrackDown(Song); Text.Format(TRACK_FORMAT, Song + 1, m_pDocument->GetTrackTitle(Song)); m_pSongList->SetItemText(Song, 0, Text); Text.Format(TRACK_FORMAT, Song + 2, m_pDocument->GetTrackTitle(Song + 1)); m_pSongList->SetItemText(Song + 1, 0, Text); SelectSong(Song + 1); }
void CModulePropertiesDlg::OnBnClickedSongAdd() { CString TrackTitle; // Try to add a track int NewTrack = m_pDocument->AddTrack(); if (NewTrack == -1) return; m_pDocument->UpdateAllViews(NULL, UPDATE_TRACK); TrackTitle.Format(TRACK_FORMAT, NewTrack, m_pDocument->GetTrackTitle(NewTrack).GetString()); static_cast<CListCtrl*>(GetDlgItem(IDC_SONGLIST))->InsertItem(NewTrack, TrackTitle); SelectSong(NewTrack); }
void CModulePropertiesDlg::FillSongList() { CListCtrl *pSongList = static_cast<CListCtrl*>(GetDlgItem(IDC_SONGLIST)); CString Text; pSongList->DeleteAllItems(); // Song editor int Songs = m_pDocument->GetTrackCount(); for (int i = 0; i < Songs; ++i) { Text.Format(TRACK_FORMAT, i + 1, m_pDocument->GetTrackTitle(i).GetString()); // start counting songs from 1 pSongList->InsertItem(i, Text); } // Select first song when dialog is displayed SelectSong(0); }
void CModulePropertiesDlg::OnBnClickedSongDown() { CListCtrl *pSongList = static_cast<CListCtrl*>(GetDlgItem(IDC_SONGLIST)); int Song = m_iSelectedSong; CString Text; if (Song == (m_pDocument->GetTrackCount() - 1)) return; m_pDocument->MoveTrackDown(Song); m_pDocument->UpdateAllViews(NULL, UPDATE_TRACK); Text.Format(TRACK_FORMAT, Song + 1, m_pDocument->GetTrackTitle(Song).GetString()); pSongList->SetItemText(Song, 0, Text); Text.Format(TRACK_FORMAT, Song + 2, m_pDocument->GetTrackTitle(Song + 1).GetString()); pSongList->SetItemText(Song + 1, 0, Text); SelectSong(Song + 1); }
bool LoadPSIDFile(const char *file) { // Open file FILE *f = fopen(file, "rb"); if (f == NULL) return false; // Clear C64 RAM MemoryClear(); psid_loaded = false; // Load and check header uint8_t header[PSID_MAX_HEADER_LENGTH]; memset(header, 0, PSID_MAX_HEADER_LENGTH); size_t actual = fread(header, 1, PSID_MAX_HEADER_LENGTH, f); if (actual < PSID_MIN_HEADER_LENGTH || !IsPSIDHeader(header)) { fclose(f); return false; } // Extract data from header number_of_songs = read_psid_16(header, PSID_NUMBER); if (number_of_songs == 0) number_of_songs = 1; current_song = read_psid_16(header, PSID_DEFSONG); if (current_song) current_song--; if (current_song >= number_of_songs) current_song = 0; init_adr = read_psid_16(header, PSID_INIT); play_adr = read_psid_16(header, PSID_MAIN); play_adr_from_irq_vec = (play_adr == 0); speed_flags = read_psid_32(header, PSID_SPEED); strncpy(module_name, (char *)(header + PSID_NAME), 32); strncpy(author_name, (char *)(header + PSID_AUTHOR), 32); strncpy(copyright_info, (char *)(header + PSID_COPYRIGHT), 32); module_name[32] = 0; author_name[32] = 0; copyright_info[32] = 0; // Seek to start of module data fseek(f, read_psid_16(header, PSID_LENGTH), SEEK_SET); // Find load address uint16_t load_adr = read_psid_16(header, PSID_START); if (load_adr == 0) { // Load address is at start of module data uint8_t lo = fgetc(f); uint8_t hi = fgetc(f); load_adr = (hi << 8) | lo; } if (init_adr == 0) // Init routine address is equal to load address init_adr = load_adr; // Load module data to C64 RAM fread(ram + load_adr, 1, RAM_SIZE - load_adr, f); fclose(f); // Select default song SelectSong(current_song); // Everything OK psid_loaded = true; return true; }
int main(int argc, char **argv) { // Print banner printf( "SIDPlayer Version 4.4\n\n" "Copyright (C) 1996-2004 Christian Bauer\n" "E-mail: [email protected]\n" "http://www.uni-mainz.de/~bauec002/\n\n" "This is free software with ABSOLUTELY NO WARRANTY.\n" "You are welcome to redistribute it under certain conditions.\n" "For details, see the file COPYING.\n\n" ); // Initialize everything if (SDL_Init(SDL_INIT_AUDIO) < 0) { fprintf(stderr, "Couldn't initialize SDL (%s)\n", SDL_GetError()); exit(1); } atexit(quit); InitAll(argc, argv); int32 speed = PrefsFindInt32("speed"); // Parse non-option arguments const char *file_name = NULL; int song = 0; int i; for (i=1; i<argc; i++) { if (strcmp(argv[i], "--help") == 0) usage(argv[0]); else if (argv[i][0] == '-') { fprintf(stderr, "Unrecognized option '%s'\n", argv[i]); usage(argv[0]); } else { if (file_name == NULL) file_name = argv[i]; // First non-option argument is file name else song = atoi(argv[i]); // Second non-option argument is song number } } if (file_name == NULL) usage(argv[0]); // Load given PSID file if (!LoadPSIDFile(file_name)) { fprintf(stderr, "Couldn't load '%s' (not a PSID file?)\n", file_name); exit(1); } // Select song if (song > 0) { if (song > number_of_songs) song = number_of_songs; SelectSong(song - 1); } SIDAdjustSpeed(speed); // SelectSong and LoadPSIDFile() reset this to 100% // Print file information printf("Module Name: %s\n", module_name); printf("Author : %s\n", author_name); printf("Copyright : %s\n\n", copyright_info); printf("Playing song %d/%d\n", current_song + 1, number_of_songs); // Start replay and enter main loop SDL_PauseAudio(false); while (true) { SDL_Event e; if (SDL_WaitEvent(&e)) { if (e.type == SDL_QUIT) break; } } ExitAll(); return 0; }