Mercurial > hg > dmlib
comparison tools/ppl.c @ 2586:9807ae37ad69
Require stdbool.h, we require C11 now.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 08 Dec 2022 15:59:22 +0200 |
parents | d56a0e86067a |
children |
comparison
equal
deleted
inserted
replaced
2585:ef6c826c5b7a | 2586:9807ae37ad69 |
---|---|
21 #include "setupfont.h" | 21 #include "setupfont.h" |
22 | 22 |
23 | 23 |
24 struct | 24 struct |
25 { | 25 { |
26 BOOL exitFlag; | 26 bool exitFlag; |
27 | 27 |
28 SDL_Window *window; | 28 SDL_Window *window; |
29 SDL_Renderer *renderer; | 29 SDL_Renderer *renderer; |
30 SDL_Texture *texture; | 30 SDL_Texture *texture; |
31 SDL_Surface *screen; | 31 SDL_Surface *screen; |
32 SDL_Event event; | 32 SDL_Event event; |
33 | 33 |
34 int optScrWidth, optScrHeight, optVFlags, optScrDepth; | 34 int optScrWidth, optScrHeight, optVFlags, optScrDepth; |
35 | 35 |
36 int actChannel; | 36 int actChannel; |
37 BOOL pauseFlag; | 37 bool pauseFlag; |
38 | 38 |
39 JSSModule *mod; | 39 JSSModule *mod; |
40 JSSMixer *dev; | 40 JSSMixer *dev; |
41 JSSPlayer *plr; | 41 JSSPlayer *plr; |
42 SDL_AudioSpec afmt; | 42 SDL_AudioSpec afmt; |
59 int optOutFormat = JSS_AUDIO_S16, | 59 int optOutFormat = JSS_AUDIO_S16, |
60 optOutChannels = 2, | 60 optOutChannels = 2, |
61 optOutFreq = 48000, | 61 optOutFreq = 48000, |
62 optMuteOChannels = -1, | 62 optMuteOChannels = -1, |
63 optStartOrder = 0; | 63 optStartOrder = 0; |
64 BOOL optUsePlayTime = FALSE, | 64 bool optUsePlayTime = false, |
65 optUseGUI = TRUE; | 65 optUseGUI = true; |
66 size_t optPlayTime; | 66 size_t optPlayTime; |
67 | 67 |
68 | 68 |
69 static const DMOptArg optList[] = | 69 static const DMOptArg optList[] = |
70 { | 70 { |
95 dmPrintBanner(stdout, dmProgName, "[options] <module>"); | 95 dmPrintBanner(stdout, dmProgName, "[options] <module>"); |
96 dmArgsPrintHelp(stdout, optList, optListN, 0, 80 - 2); | 96 dmArgsPrintHelp(stdout, optList, optListN, 0, 80 - 2); |
97 } | 97 } |
98 | 98 |
99 | 99 |
100 BOOL argHandleOpt(const int optN, char *optArg, char *currArg) | 100 bool argHandleOpt(const int optN, char *optArg, char *currArg) |
101 { | 101 { |
102 switch (optN) | 102 switch (optN) |
103 { | 103 { |
104 case 0: | 104 case 0: |
105 argShowHelp(); | 105 argShowHelp(); |
118 case 10: | 118 case 10: |
119 eng.optVFlags |= SDL_WINDOW_FULLSCREEN_DESKTOP; | 119 eng.optVFlags |= SDL_WINDOW_FULLSCREEN_DESKTOP; |
120 break; | 120 break; |
121 | 121 |
122 case 12: | 122 case 12: |
123 optUseGUI = FALSE; | 123 optUseGUI = false; |
124 break; | 124 break; |
125 | 125 |
126 case 14: | 126 case 14: |
127 { | 127 { |
128 int w, h; | 128 int w, h; |
129 if (sscanf(optArg, "%dx%d", &w, &h) == 2) | 129 if (sscanf(optArg, "%dx%d", &w, &h) == 2) |
130 { | 130 { |
131 if (w < 320 || h < 200 || w > 3200 || h > 3200) | 131 if (w < 320 || h < 200 || w > 3200 || h > 3200) |
132 { | 132 { |
133 dmErrorMsg("Invalid width or height: %d x %d\n", w, h); | 133 dmErrorMsg("Invalid width or height: %d x %d\n", w, h); |
134 return FALSE; | 134 return false; |
135 } | 135 } |
136 eng.optScrWidth = w; | 136 eng.optScrWidth = w; |
137 eng.optScrHeight = h; | 137 eng.optScrHeight = h; |
138 } | 138 } |
139 else | 139 else |
140 { | 140 { |
141 dmErrorMsg("Invalid size argument '%s'.\n", optArg); | 141 dmErrorMsg("Invalid size argument '%s'.\n", optArg); |
142 return FALSE; | 142 return false; |
143 } | 143 } |
144 } | 144 } |
145 break; | 145 break; |
146 | 146 |
147 case 16: | 147 case 16: |
172 optStartOrder = atoi(optArg); | 172 optStartOrder = atoi(optArg); |
173 break; | 173 break; |
174 | 174 |
175 case 32: | 175 case 32: |
176 optPlayTime = atoi(optArg); | 176 optPlayTime = atoi(optArg); |
177 optUsePlayTime = TRUE; | 177 optUsePlayTime = true; |
178 break; | 178 break; |
179 | 179 |
180 default: | 180 default: |
181 dmErrorMsg("Unimplemented option argument '%s'.\n", currArg); | 181 dmErrorMsg("Unimplemented option argument '%s'.\n", currArg); |
182 return FALSE; | 182 return false; |
183 } | 183 } |
184 | 184 |
185 return TRUE; | 185 return true; |
186 } | 186 } |
187 | 187 |
188 | 188 |
189 BOOL argHandleFile(char *currArg) | 189 bool argHandleFile(char *currArg) |
190 { | 190 { |
191 if (!optFilename) | 191 if (!optFilename) |
192 optFilename = currArg; | 192 optFilename = currArg; |
193 else | 193 else |
194 { | 194 { |
195 dmErrorMsg("Too many filename arguments '%s'\n", currArg); | 195 dmErrorMsg("Too many filename arguments '%s'\n", currArg); |
196 return FALSE; | 196 return false; |
197 } | 197 } |
198 | 198 |
199 return TRUE; | 199 return true; |
200 } | 200 } |
201 | 201 |
202 | 202 |
203 static inline Uint32 dmCol(const float r, const float g, const float b) | 203 static inline Uint32 dmCol(const float r, const float g, const float b) |
204 { | 204 { |
205 return dmMapRGB(eng.screen, 255.0f * r, 255.0f * g, 255.0f * b); | 205 return dmMapRGB(eng.screen, 255.0f * r, 255.0f * g, 255.0f * b); |
206 } | 206 } |
207 | 207 |
208 | 208 |
209 BOOL dmInitializeVideo() | 209 bool dmInitializeVideo() |
210 { | 210 { |
211 SDL_DestroyTexture(eng.texture); | 211 SDL_DestroyTexture(eng.texture); |
212 SDL_FreeSurface(eng.screen); | 212 SDL_FreeSurface(eng.screen); |
213 | 213 |
214 if ((eng.texture = SDL_CreateTexture(eng.renderer, | 214 if ((eng.texture = SDL_CreateTexture(eng.renderer, |
215 SDL_PIXELFORMAT_RGBA32, SDL_TEXTUREACCESS_STREAMING, | 215 SDL_PIXELFORMAT_RGBA32, SDL_TEXTUREACCESS_STREAMING, |
216 eng.optScrWidth, eng.optScrHeight)) == NULL) | 216 eng.optScrWidth, eng.optScrHeight)) == NULL) |
217 { | 217 { |
218 dmErrorMsg("Could not create SDL texture.\n"); | 218 dmErrorMsg("Could not create SDL texture.\n"); |
219 return FALSE; | 219 return false; |
220 } | 220 } |
221 | 221 |
222 if ((eng.screen = SDL_CreateRGBSurfaceWithFormat(0, | 222 if ((eng.screen = SDL_CreateRGBSurfaceWithFormat(0, |
223 eng.optScrWidth, eng.optScrHeight, | 223 eng.optScrWidth, eng.optScrHeight, |
224 32, SDL_PIXELFORMAT_RGBA32)) == NULL) | 224 32, SDL_PIXELFORMAT_RGBA32)) == NULL) |
225 { | 225 { |
226 dmErrorMsg("Could not create SDL surface.\n"); | 226 dmErrorMsg("Could not create SDL surface.\n"); |
227 return FALSE; | 227 return false; |
228 } | 228 } |
229 | 229 |
230 col.black = dmCol(0 , 0 , 0); | 230 col.black = dmCol(0 , 0 , 0); |
231 col.inboxBg = dmCol(0.6, 0.5, 0.2); | 231 col.inboxBg = dmCol(0.6, 0.5, 0.2); |
232 col.boxBg = dmCol(0.7, 0.6, 0.3); | 232 col.boxBg = dmCol(0.7, 0.6, 0.3); |
237 col.activeChannel = dmCol(0.6, 0.8, 0.2); | 237 col.activeChannel = dmCol(0.6, 0.8, 0.2); |
238 col.muted = dmCol(0.3, 0.1, 0.1); | 238 col.muted = dmCol(0.3, 0.1, 0.1); |
239 col.scope = dmCol(0 , 0.8, 0); | 239 col.scope = dmCol(0 , 0.8, 0); |
240 col.red = dmCol(1 , 0 , 0); | 240 col.red = dmCol(1 , 0 , 0); |
241 | 241 |
242 return TRUE; | 242 return true; |
243 } | 243 } |
244 | 244 |
245 | 245 |
246 // | 246 // |
247 // XXX TODO: To display actual continuous sample data for channel, | 247 // XXX TODO: To display actual continuous sample data for channel, |
537 jvmRenderAudio(d, stream, len / jvmGetSampleSize(d)); | 537 jvmRenderAudio(d, stream, len / jvmGetSampleSize(d)); |
538 } | 538 } |
539 } | 539 } |
540 | 540 |
541 | 541 |
542 void dmMuteChannels(BOOL mute) | 542 void dmMuteChannels(bool mute) |
543 { | 543 { |
544 for (int i = 0; i < eng.mod->nchannels; i++) | 544 for (int i = 0; i < eng.mod->nchannels; i++) |
545 jvmMute(eng.dev, i, mute); | 545 jvmMute(eng.dev, i, mute); |
546 } | 546 } |
547 | 547 |
548 | 548 |
549 int main(int argc, char *argv[]) | 549 int main(int argc, char *argv[]) |
550 { | 550 { |
551 BOOL initSDL = FALSE, audioInit = FALSE; | 551 bool initSDL = false, audioInit = false; |
552 DMResource *file = NULL; | 552 DMResource *file = NULL; |
553 int res = DMERR_OK; | 553 int res = DMERR_OK; |
554 BOOL muteState = FALSE; | 554 bool muteState = false; |
555 | 555 |
556 memset(&eng, 0, sizeof(eng)); | 556 memset(&eng, 0, sizeof(eng)); |
557 | 557 |
558 eng.optScrWidth = 640; | 558 eng.optScrWidth = 640; |
559 eng.optScrHeight = 480; | 559 eng.optScrHeight = 480; |
590 #ifdef JSS_SUP_XM | 590 #ifdef JSS_SUP_XM |
591 if (eng.mod == NULL) | 591 if (eng.mod == NULL) |
592 { | 592 { |
593 dmMsg(2, "* Trying XM...\n"); | 593 dmMsg(2, "* Trying XM...\n"); |
594 dmfreset(file); | 594 dmfreset(file); |
595 if ((res = jssLoadXM(file, &eng.mod, TRUE)) == DMERR_OK) | 595 if ((res = jssLoadXM(file, &eng.mod, true)) == DMERR_OK) |
596 { | 596 { |
597 dmfreset(file); | 597 dmfreset(file); |
598 res = jssLoadXM(file, &eng.mod, FALSE); | 598 res = jssLoadXM(file, &eng.mod, false); |
599 } | 599 } |
600 } | 600 } |
601 #endif | 601 #endif |
602 #ifdef JSS_SUP_JSSMOD | 602 #ifdef JSS_SUP_JSSMOD |
603 if (eng.mod == NULL) | 603 if (eng.mod == NULL) |
604 { | 604 { |
605 dmMsg(1, "* Trying JSSMOD ...\n"); | 605 dmMsg(1, "* Trying JSSMOD ...\n"); |
606 dmfreset(file); | 606 dmfreset(file); |
607 if ((res = jssLoadJSSMOD(file, &eng.mod, TRUE)) == DMERR_OK) | 607 if ((res = jssLoadJSSMOD(file, &eng.mod, true)) == DMERR_OK) |
608 { | 608 { |
609 dmfreset(file); | 609 dmfreset(file); |
610 res = jssLoadJSSMOD(file, &eng.mod, FALSE); | 610 res = jssLoadJSSMOD(file, &eng.mod, false); |
611 } | 611 } |
612 } | 612 } |
613 #endif | 613 #endif |
614 dmf_close(file); | 614 dmf_close(file); |
615 | 615 |
644 res = dmError(DMERR_INIT_FAIL, | 644 res = dmError(DMERR_INIT_FAIL, |
645 "Could not initialize SDL: %s\n", | 645 "Could not initialize SDL: %s\n", |
646 SDL_GetError()); | 646 SDL_GetError()); |
647 goto out; | 647 goto out; |
648 } | 648 } |
649 initSDL = TRUE; | 649 initSDL = true; |
650 | 650 |
651 | 651 |
652 // Initialize mixing device | 652 // Initialize mixing device |
653 dmMsg(2, "Initializing miniJSS mixer with: %d, %d, %d\n", | 653 dmMsg(2, "Initializing miniJSS mixer with: %d, %d, %d\n", |
654 optOutFormat, optOutChannels, optOutFreq); | 654 optOutFormat, optOutChannels, optOutFreq); |
686 res = dmError(DMERR_INIT_FAIL, | 686 res = dmError(DMERR_INIT_FAIL, |
687 "Couldn't open SDL audio: %s\n", | 687 "Couldn't open SDL audio: %s\n", |
688 SDL_GetError()); | 688 SDL_GetError()); |
689 goto out; | 689 goto out; |
690 } | 690 } |
691 audioInit = TRUE; | 691 audioInit = true; |
692 | 692 |
693 // Initialize player | 693 // Initialize player |
694 if ((eng.plr = jmpInit(eng.dev)) == NULL) | 694 if ((eng.plr = jmpInit(eng.dev)) == NULL) |
695 { | 695 { |
696 res = dmError(DMERR_INIT_FAIL, | 696 res = dmError(DMERR_INIT_FAIL, |
703 jmpPlayOrder(eng.plr, optStartOrder); | 703 jmpPlayOrder(eng.plr, optStartOrder); |
704 jvmSetGlobalVol(eng.dev, 200); | 704 jvmSetGlobalVol(eng.dev, 200); |
705 | 705 |
706 if (optMuteOChannels >= 0 && optMuteOChannels < eng.mod->nchannels) | 706 if (optMuteOChannels >= 0 && optMuteOChannels < eng.mod->nchannels) |
707 { | 707 { |
708 dmMuteChannels(TRUE); | 708 dmMuteChannels(true); |
709 jvmMute(eng.dev, optMuteOChannels, FALSE); | 709 jvmMute(eng.dev, optMuteOChannels, false); |
710 eng.actChannel = optMuteOChannels; | 710 eng.actChannel = optMuteOChannels; |
711 muteState = TRUE; | 711 muteState = true; |
712 } | 712 } |
713 | 713 |
714 if (optUseGUI) | 714 if (optUseGUI) |
715 { | 715 { |
716 // Get font | 716 // Get font |
780 | 780 |
781 int currTick, prevTick = 0, prevRow = -1; | 781 int currTick, prevTick = 0, prevRow = -1; |
782 while (!eng.exitFlag) | 782 while (!eng.exitFlag) |
783 { | 783 { |
784 currTick = SDL_GetTicks(); | 784 currTick = SDL_GetTicks(); |
785 BOOL needUpdate = (currTick - prevTick > 500), | 785 bool needUpdate = (currTick - prevTick > 500), |
786 needRender = FALSE; | 786 needRender = false; |
787 | 787 |
788 while (SDL_PollEvent(&eng.event)) | 788 while (SDL_PollEvent(&eng.event)) |
789 switch (eng.event.type) | 789 switch (eng.event.type) |
790 { | 790 { |
791 case SDL_KEYDOWN: | 791 case SDL_KEYDOWN: |
792 switch (eng.event.key.keysym.sym) | 792 switch (eng.event.key.keysym.sym) |
793 { | 793 { |
794 case SDLK_ESCAPE: | 794 case SDLK_ESCAPE: |
795 case SDLK_q: | 795 case SDLK_q: |
796 eng.exitFlag = TRUE; | 796 eng.exitFlag = true; |
797 break; | 797 break; |
798 | 798 |
799 case SDLK_SPACE: | 799 case SDLK_SPACE: |
800 eng.pauseFlag = !eng.pauseFlag; | 800 eng.pauseFlag = !eng.pauseFlag; |
801 SDL_PauseAudio(eng.pauseFlag); | 801 SDL_PauseAudio(eng.pauseFlag); |
803 | 803 |
804 case SDLK_LEFT: | 804 case SDLK_LEFT: |
805 if (eng.actChannel > 0) | 805 if (eng.actChannel > 0) |
806 { | 806 { |
807 eng.actChannel--; | 807 eng.actChannel--; |
808 needUpdate = TRUE; | 808 needUpdate = true; |
809 } | 809 } |
810 break; | 810 break; |
811 | 811 |
812 case SDLK_RIGHT: | 812 case SDLK_RIGHT: |
813 if (eng.actChannel < eng.mod->nchannels - 1) | 813 if (eng.actChannel < eng.mod->nchannels - 1) |
814 { | 814 { |
815 eng.actChannel++; | 815 eng.actChannel++; |
816 needUpdate = TRUE; | 816 needUpdate = true; |
817 } | 817 } |
818 break; | 818 break; |
819 | 819 |
820 case SDLK_m: | 820 case SDLK_m: |
821 if (eng.event.key.keysym.mod & KMOD_SHIFT) | 821 if (eng.event.key.keysym.mod & KMOD_SHIFT) |
824 dmMuteChannels(muteState); | 824 dmMuteChannels(muteState); |
825 } | 825 } |
826 else | 826 else |
827 if (eng.event.key.keysym.mod & KMOD_CTRL) | 827 if (eng.event.key.keysym.mod & KMOD_CTRL) |
828 { | 828 { |
829 dmMuteChannels(FALSE); | 829 dmMuteChannels(false); |
830 } | 830 } |
831 else | 831 else |
832 { | 832 { |
833 jvmMute(eng.dev, eng.actChannel, !jvmGetMute(eng.dev, eng.actChannel)); | 833 jvmMute(eng.dev, eng.actChannel, !jvmGetMute(eng.dev, eng.actChannel)); |
834 } | 834 } |
835 needUpdate = TRUE; | 835 needUpdate = true; |
836 break; | 836 break; |
837 | 837 |
838 case SDLK_PAGEUP: | 838 case SDLK_PAGEUP: |
839 JSS_LOCK(eng.dev); | 839 JSS_LOCK(eng.dev); |
840 JSS_LOCK(eng.plr); | 840 JSS_LOCK(eng.plr); |
841 jmpChangeOrder(eng.plr, dmClamp(eng.plr->order - 1, 0, eng.mod->norders)); | 841 jmpChangeOrder(eng.plr, dmClamp(eng.plr->order - 1, 0, eng.mod->norders)); |
842 JSS_UNLOCK(eng.plr); | 842 JSS_UNLOCK(eng.plr); |
843 JSS_UNLOCK(eng.dev); | 843 JSS_UNLOCK(eng.dev); |
844 needUpdate = TRUE; | 844 needUpdate = true; |
845 break; | 845 break; |
846 | 846 |
847 case SDLK_PAGEDOWN: | 847 case SDLK_PAGEDOWN: |
848 JSS_LOCK(eng.dev); | 848 JSS_LOCK(eng.dev); |
849 JSS_LOCK(eng.plr); | 849 JSS_LOCK(eng.plr); |
850 jmpChangeOrder(eng.plr, dmClamp(eng.plr->order + 1, 0, eng.mod->norders)); | 850 jmpChangeOrder(eng.plr, dmClamp(eng.plr->order + 1, 0, eng.mod->norders)); |
851 JSS_UNLOCK(eng.plr); | 851 JSS_UNLOCK(eng.plr); |
852 JSS_UNLOCK(eng.dev); | 852 JSS_UNLOCK(eng.dev); |
853 needUpdate = TRUE; | 853 needUpdate = true; |
854 break; | 854 break; |
855 | 855 |
856 case SDLK_f: | 856 case SDLK_f: |
857 eng.optVFlags ^= SDL_WINDOW_FULLSCREEN_DESKTOP; | 857 eng.optVFlags ^= SDL_WINDOW_FULLSCREEN_DESKTOP; |
858 if (SDL_SetWindowFullscreen(eng.window, eng.optVFlags) != 0) | 858 if (SDL_SetWindowFullscreen(eng.window, eng.optVFlags) != 0) |
859 goto out; | 859 goto out; |
860 needUpdate = TRUE; | 860 needUpdate = true; |
861 break; | 861 break; |
862 | 862 |
863 default: | 863 default: |
864 break; | 864 break; |
865 } | 865 } |
868 | 868 |
869 case SDL_WINDOWEVENT: | 869 case SDL_WINDOWEVENT: |
870 switch (eng.event.window.event) | 870 switch (eng.event.window.event) |
871 { | 871 { |
872 case SDL_WINDOWEVENT_EXPOSED: | 872 case SDL_WINDOWEVENT_EXPOSED: |
873 needUpdate = TRUE; | 873 needUpdate = true; |
874 break; | 874 break; |
875 | 875 |
876 case SDL_WINDOWEVENT_RESIZED: | 876 case SDL_WINDOWEVENT_RESIZED: |
877 eng.optScrWidth = eng.event.window.data1; | 877 eng.optScrWidth = eng.event.window.data1; |
878 eng.optScrHeight = eng.event.window.data2; | 878 eng.optScrHeight = eng.event.window.data2; |
879 if (!dmInitializeVideo()) | 879 if (!dmInitializeVideo()) |
880 goto out; | 880 goto out; |
881 | 881 |
882 needUpdate = TRUE; | 882 needUpdate = true; |
883 break; | 883 break; |
884 } | 884 } |
885 break; | 885 break; |
886 | 886 |
887 case SDL_QUIT: | 887 case SDL_QUIT: |
888 eng.exitFlag = TRUE; | 888 eng.exitFlag = true; |
889 break; | 889 break; |
890 } | 890 } |
891 | 891 |
892 // Check for end of song | 892 // Check for end of song |
893 JSS_LOCK(eng.plr); | 893 JSS_LOCK(eng.plr); |
894 if (!eng.plr->isPlaying) | 894 if (!eng.plr->isPlaying) |
895 eng.exitFlag = TRUE; | 895 eng.exitFlag = true; |
896 JSS_UNLOCK(eng.plr); | 896 JSS_UNLOCK(eng.plr); |
897 | 897 |
898 if (optUseGUI) | 898 if (optUseGUI) |
899 { | 899 { |
900 // Check if we need to update screen | 900 // Check if we need to update screen |
904 JSS_UNLOCK(eng.plr); | 904 JSS_UNLOCK(eng.plr); |
905 | 905 |
906 if (currRow != prevRow || needUpdate) | 906 if (currRow != prevRow || needUpdate) |
907 { | 907 { |
908 prevRow = currRow; | 908 prevRow = currRow; |
909 needUpdate = TRUE; | 909 needUpdate = true; |
910 } | 910 } |
911 | 911 |
912 // Draw frame | 912 // Draw frame |
913 if (needUpdate) | 913 if (needUpdate) |
914 { | 914 { |
933 eng.plr->tempo, eng.plr->speed, | 933 eng.plr->tempo, eng.plr->speed, |
934 eng.plr->row, (eng.plr->pattern != NULL) ? eng.plr->pattern->nrows : 0, | 934 eng.plr->row, (eng.plr->pattern != NULL) ? eng.plr->pattern->nrows : 0, |
935 eng.plr->order + 1, eng.mod->norders, | 935 eng.plr->order + 1, eng.mod->norders, |
936 eng.plr->npattern, eng.mod->npatterns); | 936 eng.plr->npattern, eng.mod->npatterns); |
937 JSS_UNLOCK(eng.plr); | 937 JSS_UNLOCK(eng.plr); |
938 needRender = TRUE; | 938 needRender = true; |
939 } | 939 } |
940 | 940 |
941 if (needUpdate || currTick - prevTick >= (eng.pauseFlag ? 100 : 20)) | 941 if (needUpdate || currTick - prevTick >= (eng.pauseFlag ? 100 : 20)) |
942 { | 942 { |
943 JSS_LOCK(eng.dev); | 943 JSS_LOCK(eng.dev); |
944 dmDisplayChannels(eng.screen, 5, eng.screen->h * 0.8 + 5, | 944 dmDisplayChannels(eng.screen, 5, eng.screen->h * 0.8 + 5, |
945 eng.screen->w - 5, eng.screen->h - 5, eng.dev); | 945 eng.screen->w - 5, eng.screen->h - 5, eng.dev); |
946 JSS_UNLOCK(eng.dev); | 946 JSS_UNLOCK(eng.dev); |
947 needRender = TRUE; | 947 needRender = true; |
948 } | 948 } |
949 | 949 |
950 if (needUpdate) | 950 if (needUpdate) |
951 prevTick = currTick; | 951 prevTick = currTick; |
952 | 952 |
955 { | 955 { |
956 SDL_Surface dst; | 956 SDL_Surface dst; |
957 SDL_LockTexture(eng.texture, NULL, &dst.pixels, &dst.pitch); | 957 SDL_LockTexture(eng.texture, NULL, &dst.pixels, &dst.pitch); |
958 | 958 |
959 if (dst.pitch != eng.screen->pitch) | 959 if (dst.pitch != eng.screen->pitch) |
960 eng.exitFlag = TRUE; | 960 eng.exitFlag = true; |
961 else | 961 else |
962 memcpy(dst.pixels, eng.screen->pixels, eng.screen->h * dst.pitch); | 962 memcpy(dst.pixels, eng.screen->pixels, eng.screen->h * dst.pitch); |
963 | 963 |
964 SDL_UnlockTexture(eng.texture); | 964 SDL_UnlockTexture(eng.texture); |
965 | 965 |