Instead of asking "What's the max value for capacity ?", ask "What's the min weight to achieve value ?" If you can compute the minimum weight needed for every possible value from to , you can find the largest where that minimum weight is at most .
Same problem, different angle. The dimension that was becomes the answer you're searching for. The dimension that was at most becomes your DP index.