1: TODO:
     2:  
     3:  mode exit mechanism
     4:    - new function in modes.c, 'mode_transition_initiate(new mode)'
     5:      - sets a global timeval for the time when the mode exit was initiated
     6:        - up to mode to do whatever it wants in this exit phase, then call
     7:          mode_transition_finalize which actually sets new_mode
     8: 	 - input should probably be disregarded during exit transition
     9: 	  
    10:     
    11:  update mechanims
    12:    - use nonblocking abortable mode instead of preemptive loop
    13: 
    14:  H go over vram bank setting now that I grok it better having found-
    15:    - http://www.dev-scene.com/NDS/NDS_Tutorials_VramTable 
    16: 
    17:  H textviewer mode: firstpass for help
    18: 
    19:  H die() needs to take printf args, and reliably print an error message
    20:    - probably existing assert function is even sufficient, though for fun
    21:      may want to effectively reimplement it, just simple one screen console init...
    22: 
    23:  H libtremor, ogg playability
    24: 
    25:  M splash scroll hexmatrix font splash bottom (welcome to guitar zyx)
    26:   - perhaps scaled/colored font at first
    27: 
    28:  M test max throughput both to file and wifi (i.e. enough for audio?)
    29: 
    30:  M synthpad, local and remote, with buttons
    31: 
    32:  M need to polish the rest of the mode transitions as I partially did
    33:    for the intro transition.  I.e. I think zeroing out the background
    34:    if I I don't want a flicker, or also bypassing videomodesetting if
    35:    the mode isn't changing, and I want the background to persist.  I.e.
    36:    I think currently I have lava lower background fading, even though 
    37:    I want it to persist, with only the text fading
    38: 
    39: L mcp_kb_init with externs, etc... (could be a lurking console bug)
    40:   - for bonus points, try with lava, and if so, go for abstratifying the few common modesets
    41: 
    42: L code cleanups
    43:   - definitely the set up of the < half doz background/vid modes can be consolidated
    44:     - simple console goes on 0 (or 3D?)
    45:     - kb goes on 1
    46:     - 256c simple background goes on 2
    47:     - 16bit bg or 3D or scaled console goes on 3
    48:   - fadein/out code could be made to have default behaviour
    49:     - mode struct could have simple top/bot fade pre/fadein/fadeout/post values
    50:     - these get overridden by #defines if nondefault is used
    51: 
    52: L arch/desn: make modes array of mode function pointers a linked list on the heap,
    53:   i.e. only have to add a new mode to modes.h, then each of those gets
    54:   initially added to the linked list.
    55: 
    56: L build: put modes in directory, lose mode__ namespace
    57: 
    58: L aesthetic: appropriately rename mode_intro__credits to mode_show_credits
    59: 
    60: L client: scroll pad infra: add touchpad based scrolling
    61:   - nearest neighbor in un-pad area, same in pad, but pad area implies scrolling (by a ramping speed)
    62: 
    63: L function for do_blend_fade and do_text_fade
    64:   - take mode_ms, and 4 timing parameters, and for text, address of pallette entry and full value
    65:     - good first candidate for libdmc, along with timeval
    66: 
    67: U use etrace/ptrace/__cyg_profile_func_enter()/_exit to profile stack usage to file,
    68:   document it in hacking
    69:   - and while at it, do a -DFIRSTMODE=XXX
    70: 
    71: U alternate undoubled menu mode
    72:   - maybe even dynamic width option
    73: 
    74: U have unselectable flag for entries, and then put an entry on every line instead of e-other
    75: 
    76:  - mic: try audio packets over wifi (does dsi buy more bw?), and to file
    77:  - input: steve(&agree): basic log/recording, suitable for input playback effectively
    78:  - user/custom: pull userstring, birthday, favcolor from usermem
    79:  - input: pull user touchpad cal from usermem, see if it seems obviously relevent
    80:    - prerender a 0..255 128 value lut from that info, then >>1 for typ midival
    81:  - arch/desn: keep/generate statistics on number of times the Hz counters are 
    82:  skipped, i.e. number of loops where nothing is done.  perhaps adding a 
    83: trivial compute (1flop) function, to measure a number of 'idle flops'...
    84:  - ogl: 2nd pass at using fixedpoint for GL stuff instead of floats
    85:  - c: start a style document
    86:  - fs: use fat file reading for image files
    87:     - nitrofs backups
    88:  - on liveusb, '[sudo ]gzmcp nukeformat next-plugged-in-usbdisk'
    89:  - on liveusb, 'sudo gzmcp trybrowse next-plugged-in-usbdisk'
    90:  - udp experiment: add configfile setting for experimental alternate udp implementation
    91:  - rak: add interface to rak to send bank preset names, and current value probing, etc...
    92:    ping guy about that and maintenance
    93:  - security: add random magic cookie in default configfile for 'security'
    94:    (and documented deployment process)
    95:  - c: check all return values (closesocket/shutdown, etc...)
    96:  - wifi: use Wifi_FindMatchingAP to have a list of APs to search for instead of one
    97:  - stack: spend more time on reporting function and have it log some kind
    98:     of 'max stack depth' etc...
    99: 
   100: 
   101:  DEBUG/LOGGING INFRASTRUCTURE
   102: /
   103: 
   104:  MAX_LOG_LINE_LENGTH defaults to 32 (256 could be used for serious debugging)
   105:  MAX_LOG_LINES defaults to 32 (256 could be used for serious debugging)
   106:  
   107:  global pointer variable points to last log entry index (wrapping at M_L_L)
   108:  log/debug function (thin textout wrapper) also takes a delay argument (or
   109:  rather, takes a working delay argument...  this will obsolete the broken one).
   110:  these delays will cause a global timestamp in the future to be set, upon 
   111:  which, the debug line will be cleared.
   112: 
   113: 
   114:  at any time, an Lh+Rh+up will enable debug mode, displaying the last log
   115:  message, and disabling the auto clear mechanism.  ..+down will clear
   116:  the debug message and reenable the auto clear mechanism. +right and +left
   117:  will also enable as +up, but incr/decr the index of the log message being
   118:  shown.  
   119: 
   120:  Lh+Rh+[ABXY] should be reserved for launching 4 apps.  
   121:  (OR! for recording hotkeys- start/stop/playlast/? ... leaving startheld+abxy for starting the apps)
   122: 
   123:  apps- dslinux, moonshell, strumme, snake3d(some homebrew game until I port it)
   124: 
   125:  +start/select should do something drastic (reboot, lockscreen)
   126: 
   127:  all of this, can be l+r held for mintime (3 seconds def), to avoid
   128:  casual invocation
   129: 
   130: 
   131: 
   132:  - use NODEBUG for double line (wrap) tw-vert: and tw-horz: display
   133:    of midi (numeric at first, then alpha)
   134: 
   135:  - could use start-held + cross for tw-v&h parms, then use in normal
   136:    mode for the 4 hot-modes, thus freeing up abxy for hydro outputs
   137: 
   138:   selectheld+cross can be for incr/decr amongs presets
   139: 
   140:   selectheld+abxy can be RESERVED (or rather, the only thing left open)
   141:   ... but not something you want to cause accidental start+ bootage, maybe just another 4 apps
   142: 
   143:   startheld + abxy can be for initiating arbitary animated scripts (midi/anything)
   144: 
   145:   startheld+select can then be for online/offline
   146: 
   147:   (optionally replace all above with start/select swapped)
   148: 
   149:  LRheld(not3s-min) + double tap on touch screen can bring up advanced stylus based gui
   150: 
   151:  triple tap R toggles metronome, Lheld+R increases bpm, Rheld+L decreases bpm
   152: 
   153:  tripple tap L does something completely silly/eyecandy
   154: 
   155: --------------
   156: 
   157: 
   158: gzmcp
   159: 
   160: callbacks for toprender, bottomrender, input,
   161: global for toprender_rate, bottomrender_rate,
   162: 
   163: - start with simple array of 8 possible no arg functions
   164: 
   165: gamestate state machine, each state setting up linked list of callbacks of above
   166: - zillions of states, but a semantic namespacing with __, thus 
   167: 
   168: INTRO__MAIN__FADEIN
   169: INTRO__MAIN__HOLD
   170: INTRO__MAIN__FADEOUT
   171: INTRO__CREDITS__FADEIN
   172: INTRO__CREDITS__HOLD
   173: INTRO__CREDITS__FADEOUT
   174: INTRO__CONSOLE__FADEIN
   175: TPW__INTRO__FADEIN
   176: TPW__JAM
   177: TPW__FADEOUT
   178: // 4 fade levels/screenrenders
   179: SERVERCONSOLE__FADEIN
   180: // 4 fade levels/screenrenders
   181: SERVERCONSOLE__ACTIVE
   182: // 4 fade levels/screenrenders
   183: SERVERCONSOLE__FADEOUT
   184: // 4 fade levels/screenrenders
   185: TPW__FADEIN
   186: // 4 fade levels/screenrenders
   187: SCROLLMENU__FADEIN
   188: SCROLLMENU__ACTIVE
   189: // 4 fade levels/screenrenders
   190: SCROLLMENU__FADEOUT
   191: STRINGINPUT__FADEIN
   192: // 1st use, ssid input, use/displaystrings defined with globals
   193: STRINGINPUT__ACTIVE
   194: STRINGINPUT__FADEOUT
   195: // single slider, 
   196: //   with miniscroll numerical inputs 
   197: //   (or slider w/dragable tikmarks) 
   198: //   for min and max
   199: //   and reverse toggle
   200: SLIDERINPUT__3
   201: // one for each rakmod
   202: ONOFFINPUT__3
   203: // 10/18 radio buttons
   204: ACTIVERAKMODS__3
   205: RECCONTROL__3
   206: TUNERFEEDBACK__3
   207: 
   208: 
   209: 
   210: