MCPcopy Create free account
hub / github.com/TASEmulators/fceux / ListChoice

Function ListChoice

src/drivers/common/cheat.cpp:123–160  ·  view source on GitHub ↗

Hmm =0 for in list choices, hmm=1 for end of list choices. */ Return equals 0 to continue, -1 to stop, otherwise a number. */

Source from the content-addressed store, hash-verified

121/* Hmm =0 for in list choices, hmm=1 for end of list choices. */
122/* Return equals 0 to continue, -1 to stop, otherwise a number. */
123int ListChoice(int hmm)
124{
125 char buf[32];
126
127 if(!hmm)
128 {
129 int num=0;
130
131 tryagain:
132 printf(" <'Enter' to continue, (S)top, or enter a number.> ");
133 if ( fgets(buf,ARRAY_SIZE(buf),stdin) == nullptr )
134 {
135 return -1;
136 }
137 if(buf[0]=='s' || buf[0]=='S') return(-1);
138 if(buf[0]=='\n') return(0);
139 if(!sscanf(buf,"%d",&num))
140 return(0);
141 if(num<1) goto tryagain;
142 return(num);
143 }
144 else
145 {
146 int num=0;
147
148 tryagain2:
149 printf(" <'Enter' to make no selection or enter a number.> ");
150 if ( fgets(buf,ARRAY_SIZE(buf),stdin) == nullptr )
151 {
152 return -1;
153 }
154 if(buf[0]=='\n') return(0);
155 if(!sscanf(buf,"%d",&num))
156 return(0);
157 if(num<1) goto tryagain2;
158 return(num);
159 }
160}
161
162int EndListShow(void)
163{

Callers 2

EndListShowFunction · 0.85
AddToListFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected